Пример #1
0
void CGuiEdit::AjustaCadena(int nStartPos,int  nEndPos )
{
	
	int numCharMove=0;
	int LastChar=FindLasCharR(); //el ultimo caracter valido de la cadena
	int LastCharDel=LastChar;
	int init =nStartPos;
	for (int i=nStartPos; i <= LastChar; i++)
	{
			int nNext = GetNextPos(nStartPos);
			if (IsValidChar(m_szShowMask.GetAt(i),nNext) || m_szShowMask.GetAt(i)==m_cadResult.GetAt(i))//el caracter se puede mover a esa posicion			
			{
				//se mueve el caracter
				m_szShowMask.SetAt(nStartPos,m_szShowMask.GetAt(nNext));			
				//se reemplaza la ultima posicion despues del ultimo caracter con el
				//equivalente en la mascara
				//obtenemos la proxima posicion donde se moveria el proximo caracter
				nStartPos = GetNextPos(nStartPos);
				numCharMove++;
			}
		
	}
	DeleteString(LastCharDel,LastCharDel);
	SetSel(init,init);	
	m_KeySpecial=0;

}
Пример #2
0
void CGuiEdit::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
	// TODO: Add your message handler code here and/or call default
	if (!m_szMask.IsEmpty())
	{
		if (nChar == VK_DELETE) 
		{
			m_KeySpecial=1;
			AfxCallWndProc(this, m_hWnd, WM_CHAR, ' ', 1);
			return;
		}
		if (nChar == VK_BACK) 
		{
			m_KeySpecial=2;
			return;
		}
		if(nChar == VK_RIGHT)
		{
			int nStartPos, nEndPos;
			GetSel( nStartPos, nEndPos ); 
			m_KeySpecial=3;
			if (!ValSpecialKey(nStartPos,nEndPos))
				SetSel(nStartPos,nStartPos);	
			else
			{
				int nNext = GetNextPos(nStartPos);
				SetSel(nNext,nNext);	
			}
			return;
		}
			
		
	}
	CEdit::OnKeyDown(nChar, nRepCnt, nFlags);
}
Пример #3
0
void CRole::SetDst(Pos pos)
{
	m_bBeginFindPath = false;
	m_fdst = m_dst = pos;
	ComputeDir();

	int x = (int)(m_fdst.x/m_pMap->m_tileWidth);
	int y = (int)(m_fdst.y/m_pMap->m_tileHeight);

	if(!m_pMap->Passable(x, y))//如果目标不可到达
	{
		int bestx;int besty;
		m_bestPosFinder->FindBestPos(x, y, &bestx, &besty, m_pMap->m_map);//寻找最近可走点
		m_fdst.x = (float)bestx*m_pMap->m_tileWidth;
		m_fdst.y = (float)besty*m_pMap->m_tileHeight;
		//printf("%d %d\n", bestx, besty);
	}
	ClearPath();
	//int t=timeGetTime(); //计算寻路时间
	FindPath(&m_pos, &m_fdst);
	//printf("寻路消耗时间: %d\n",timeGetTime()-t); //
	if(GetNextPos(&m_dst, 
			(float)m_pMap->m_tileWidth/2, (float)m_pMap->m_tileHeight/2))
	ComputeDir();
	else
		SetStop();
}
Пример #4
0
void CGuiEdit::DeleteString(int nStartPos,int  nEndPos )
{
	for (int i=nStartPos; i <= nEndPos; i++)
		m_szShowMask.SetAt(i,m_cadResult.GetAt(i));	
	int nNext = GetNextPos(nStartPos);
	SetWindowText(m_szShowMask);
	if (nNext > 0)
		SetSel(nNext-1,nNext-1);	
	m_KeySpecial=0;

}
Пример #5
0
void CGuiEdit::SetMask(CString mszMask,CString mszShowMask,Mask enTypeMask)
{
	m_szMask=mszMask;
	m_szShowMask=mszShowMask;
	m_enMask=enTypeMask;
	m_cadResult=mszShowMask;
	SetWindowText(m_szShowMask);
	SetLimitText( m_szMask.GetLength()+1);
	int nNext = GetNextPos(0);
	SetSel(nNext, nNext);
}
Пример #6
0
        void UpdateAI(uint32 diff)
        {
            //Return since we have no target
            if (!UpdateVictim())
                return;

            events.Update(diff);

            if (me->HasUnitState(UNIT_STATE_CASTING))
                return;

            switch (events.GetEvent())
            {
                case EVENT_HEAT:
                    me->CastSpell(me, me->GetMap()->IsHeroic() ? SPELL_HEAT_H : SPELL_HEAT_N, true);
                    events.RepeatEvent(8000);
                    break;
                case EVENT_CHECK_HEALTH:
                    if (HealthBelowPct(HealthCheck))
                        GoToAnvil();

                    events.RepeatEvent(1000);
                    return;
                case EVENT_SHATTER:
                {
                    events.RepeatEvent(10000);
                    summons.DoAction(ACTION_SHATTER);
                    break;
                }
                case EVENT_MOVE_TO_ANVIL:
                    GetNextPos();
                    me->GetMotionMaster()->MovePoint(PointID, x, y, z);
                    events.PopEvent();
                    return;
                case EVENT_POSITION:
                    if (me->GetDistance(1331.9f, -106, 56) > 95)
                        EnterEvadeMode();
                    else
                        events.RepeatEvent(4000);
                
                    return;
            }
            
            DoMeleeAttackIfReady();
        }
Пример #7
0
BOOL  CGuiEdit::ValSpecialKey(int nStartPos,	int nEndPos)
{
	int nNext=nStartPos;
	TCHAR Char =m_szMask.GetAt(nStartPos);
	if (m_KeySpecial == 3)
	{
		nNext = GetNextPos(nStartPos);
		if (m_szShowMask.GetAt(nNext) == m_cadResult.GetAt(nNext))	
		{
			m_KeySpecial=0;	
			return FALSE;
		}
	}
	m_KeySpecial=0;	
	return TRUE;


}
Пример #8
0
//改变方向
void CSnakeGame::ChangeDirection(int iDirection)
{
	//如果是相同方向或者游戏不是运行中状态,则返回
	if (m_enGameState != GAMESTATE_RUNNING || m_iSnakeDirection == iDirection)
	{
		return;
	}

	//按钮音效
	PLAY_EFFECT(EFFECT_CHANGE2);

	//设置方向
	int nOldDirection = m_iSnakeDirection;
	m_iSnakeDirection = iDirection;

	//如果是反方向
	if (iDirection == OPPSITE_DIRECTION[nOldDirection])
	{
		//转换
		int iNodeCount = m_mapSnakeNodes.size();
		for (int i = 0; i < iNodeCount / 2; ++i)
		{
			POSITION stTempPos = m_mapSnakeNodes[i];
			m_mapSnakeNodes[i] = m_mapSnakeNodes[iNodeCount - 1 - i];
			m_mapSnakeNodes[iNodeCount - 1 - i] = stTempPos;
		}

		//获取下一个位置
		POSITION stHeaderPos = m_mapSnakeNodes[0];
		GetNextPos(stHeaderPos);

		//是否可以按照反方向移动,不能则恢复之前的方向
		if (CheckGameOver(stHeaderPos))
		{
			m_iSnakeDirection = nOldDirection;
		}
	}
	
	//移动
	SnakeMove();

	//重置时间
	m_fWaitRefreshTime = 0;
}
Пример #9
0
//1 -- DEL
//2 -- BACK
void CGuiEdit::ValidMask(UINT nChar)
{
	int nStartPos;
	int ntempStartpos;
	int nEndPos;
	int nNext;
	GetSel( nStartPos, nEndPos ); 
	ntempStartpos=nStartPos;
	if (nStartPos != nEndPos)
		if (m_KeySpecial == 1)
		{
			DeleteString(nStartPos,nEndPos-1);
			return;
		}

	if (ntempStartpos > m_cadResult.GetLength()-1)
		ntempStartpos=m_cadResult.GetLength()-1;
	if (!IsValidChar(nChar,ntempStartpos) && m_KeySpecial ==0 || 
		             nChar == 32 || nChar == 8) 
	{
		if (m_KeySpecial == 1)
		{
			//si esta un caracter no valido de la mascara
			//emita un pito y ubique el proximo valido.
			if (IsPosMask(ntempStartpos))
			{
				Beep(500,1);
				nNext = GetNextPos(ntempStartpos);
				SetSel(nNext,nNext);	
				m_KeySpecial=0;
				return;
			}
			else
			{
				AjustaCadena(nStartPos,nEndPos );	
				m_KeySpecial=0;
			}
			/*m_szShowMask.SetAt(ntempStartpos,m_cadResult.GetAt(ntempStartpos));	
			nNext = GetNextPos(ntempStartpos);
			SetWindowText(m_szShowMask);
			SetSel(nNext,nNext);	
			m_KeySpecial=0;*/
		}
		else if(m_KeySpecial == 0)
		{
			//primero verificar que no sea un caracter de la mascara por 
			//ejemplo ( - etc..
			nNext = GetNextPos(ntempStartpos);
			if (IsValidChar(nChar,nNext))
			{
				m_szShowMask.SetAt(nNext,nChar);
				nNext = GetNextPos(nNext);
				SetWindowText(m_szShowMask);
				SetSel(nNext,nNext);	
			}
			else //el caracter se desconoce
				SetSel(ntempStartpos,ntempStartpos);	
		}
		else
		{  //si es back se debe encontrar la proxima posición y 
		   //eliminar dicho espacio
				nNext = GetNextPos(nStartPos);
				m_szShowMask.SetAt(nNext,m_cadResult.GetAt(nNext));
				SetWindowText(m_szShowMask);
				SetSel(nNext,nNext);	
				m_KeySpecial=0;			
		}
		
	}
	else
	{	
		//entrada de datos normal
		m_szShowMask.SetAt(ntempStartpos,nChar);
		nNext = GetNextPos(ntempStartpos);
		SetWindowText(m_szShowMask);
		SetSel(nNext, nNext);
		if (ntempStartpos==m_szMask.GetLength()-1)
			SetSel(nNext+1, nNext+1);
		
	}
}
Пример #10
0
int  CMob::StandingByProcessor(void)
{
	int rt = FALSE;

	if (RouteType == 5 || Affect[0].Type == 24)
	{
		int Face = MOB.Equip[0].sIndex;

		if (Leader == 0 && (Affect[0].Type == 24 || Face >= 315 && Face <= 345))
		{
				rt |= 0x100;
				return rt;
		}

		if (Leader <= 0 || Leader >= MAX_USER)
		{
			rt |= 1;
			return rt;
		}

		if (Affect[0].Type == 24 || Face >= 315 && Face <= 345)
		{
			int summoner = Summoner;

			if (summoner <= 0 || summoner >= MAX_USER)
			{
				rt |= 1;
				return rt;
			}

			int _leader = 0;
			if (Leader == summoner)
				_leader = 1;

			for (int i = 0; i < MAX_PARTY; ++i)
			{
				if (pMob[Leader].PartyList[i] == summoner)
					_leader = 1;
			}

			if (_leader == 0)
			{
				rt |= 1;
				return rt;
			}

			if (pUser[summoner].Mode != USER_PLAY)
			{
				rt |= 1;
				return rt;
			}

			int Distance = BASE_GetDistance(TargetX, TargetY, pMob[summoner].TargetX, pMob[summoner].TargetY);
			if (Distance >= 13)
			{
				NextX = pMob[summoner].TargetX;
				NextY = pMob[summoner].TargetY;
				rt = rt | 0x02;
				return rt;
			}

			if (Distance <= 4 || Distance >= 13)
				return rt;

			SegmentX = pMob[summoner].TargetX;
			SegmentY = pMob[summoner].TargetY;

			GetTargetPos(summoner);
			rt = rt | 0x01;
			return rt;
		}

		rt = rt |= 1;
		return rt;
	}
	
	else
	{
		if (Leader == 0)
		{
			int enemy = GetEnemyFromView();

			if (enemy && TargetX <= SegmentX + HALFGRIDX && TargetX >= SegmentX - HALFGRIDX && TargetY >= SegmentY - HALFGRIDY && TargetY <= SegmentY + HALFGRIDY)
				return enemy | 0x10000000;
			
		}
		
		if (RouteType == 6 && TargetX == SegmentX && TargetY == SegmentY)
			return 0;

		if (SegmentX == TargetX && SegmentY == TargetY)
		{
			if(SegmentProgress == 4 && RouteType == 3)
			{
				if(WaitSec <= 0)
					return 0x10000;
				else
					WaitSec -= 6;

				return 0;
			}
			if (WaitSec <= 0 || RouteType == 6)
			{
				int Seg = SegmentWait[SegmentProgress];
				if (Seg > 0)
				{
					WaitSec = Seg;
					return 0;
				}
			}
			else
			{
				WaitSec -= 6;
				if (WaitSec > 0)
				{
					if (RouteType && TargetX != SegmentListX[0] || TargetY != SegmentListY[0])
					{
						if (MOB.BaseScore.AttackRun & 0xF)
							return rt | 0x10;

						return 0;
					}
					else
						return 0;
				}
				WaitSec = 0;
			}
			int SetSeg = SetSegment();
			
			if (SetSeg == 1)
				return 0;

			if (SetSeg == 2)
				return rt | 1;

			if (SetSeg == 0x10)
				return rt | 1;
		}

		GetNextPos(0);

		if (NextX != TargetX || NextY != TargetY)
			return rt | 1;

		else
		{
			SetSegment();
			return rt;
		}
	}
	return rt;
}
Пример #11
0
int  CMob::BattleProcessor()
{
	SelectTargetFromEnemyList();

	if (CurrentTarget == 0)
	{
		Mode = MOB_PEACE;

		return 0;
	}

	if (RouteType == 5)
	{
		if (Leader <= 0 || Leader >= MAX_USER)
			return 32;

		int SummonerId = Summoner;

		if (SummonerId <= 0 || SummonerId >= MAX_USER)
			return 256;

		int IsSummon = 0;

		if (Leader == SummonerId)
			IsSummon = 1;

		for (int i = 0; i < MAX_PARTY; i++)
		{
			if (pMob[Leader].PartyList[i] == SummonerId)
				IsSummon = 1;
		}

		if (IsSummon == 0)
			return 256;

		int dis = BASE_GetDistance(TargetX, TargetY, pMob[SummonerId].TargetX, pMob[SummonerId].TargetY);

		if (dis >= 20)
		{
			NextX = pMob[SummonerId].TargetX;
			NextY = pMob[SummonerId].TargetY;
			return 2;
		}

	}
	
	int BaseInt = MOB.BaseScore.Int;
	
	if (BaseInt < rand() % 100)
	{
		return 0x010000;
	}
	
	int BaseDex = MOB.BaseScore.Dex;
	int tx = pMob[CurrentTarget].TargetX;
	int ty = pMob[CurrentTarget].TargetY;
	int Range = GenerateIndex == KEFRA_BOSS ? 25 : BASE_GetMobAbility(&MOB, EF_RANGE);
	int dis = BASE_GetDistance(TargetX, TargetY, tx, ty);

	if (RouteType != 5 && (TargetX > SegmentX + HALFGRIDX || TargetX < SegmentX - HALFGRIDX || TargetY > SegmentY + HALFGRIDY || TargetY < SegmentY - HALFGRIDY))
	{
		CurrentTarget = 0;

		for (int i = 0; i < MAX_ENEMY; i++)
			EnemyList[i] = 0;

		Mode = MOB_PEACE;

		GetNextPos(1);

		if (NextX == TargetX && NextY == TargetY)
			return 0;
		else
			return 16;
	}
	if (dis <= Range)
	{
		int Rand = rand() % 100;

		if (Range >= 4 && dis <= 4 && Rand > BaseDex)
			return 256;

		int bx = tx;
		int by = ty;

		//BASE_GetHitPosition(TargetX, TargetY, &tx, &ty, pHeightGrid);

		if (tx == bx && ty == by)
			return 4096;
		else
			return 256;
		
	}

	return 1;
}
Пример #12
0
int BLKFAM::WriteBuffer(PGLOBAL g)
  {
  if (Tdbp->GetMode() == MODE_INSERT) {
    /*******************************************************************/
    /*  In Insert mode, blocks are added sequentially to the file end. */
    /*******************************************************************/
    if (!Closing) {                    // Add line to the write buffer
      strcat(strcpy(CurLine, Tdbp->GetLine()), CrLf);

      if (++CurNum != Rbuf) {
        CurLine += strlen(CurLine);
        return RC_OK;                  // We write only full blocks
        } // endif CurNum

      } // endif Closing

    //  Now start the writing process.
    NxtLine = CurLine + strlen(CurLine);
    BlkLen = NxtLine - To_Buf;

    if (fwrite(To_Buf, 1, BlkLen, Stream) != (size_t)BlkLen) {
      sprintf(g->Message, MSG(FWRITE_ERROR), strerror(errno));
      Closing = true;      // To tell CloseDB about a Write error
      return RC_FX;
      } // endif size

    CurBlk++;
    CurNum = 0;
    CurLine = To_Buf;
  } else {
    /*******************************************************************/
    /*  Mode == MODE_UPDATE.                                           */
    /*******************************************************************/
    char  *crlf;
    size_t len;
    int   curpos = ftell(Stream);
    bool   moved = true;

    // T_Stream is the temporary stream or the table file stream itself
    if (!T_Stream)
      if (UseTemp /*&& Tdbp->GetMode() == MODE_UPDATE*/) {
        if (OpenTempFile(g))
          return RC_FX;

      } else
        T_Stream = Stream;

    if (UseTemp) {
      /*****************************************************************/
      /*  We are using a temporary file. Before writing the updated    */
      /*  record, we must eventually copy all the intermediate records */
      /*  that have not been updated.                                  */
      /*****************************************************************/
      if (MoveIntermediateLines(g, &moved))
        return RC_FX;

      Spos = GetNextPos();                     // New start position

      // Prepare the output buffer
#if defined(WIN32)
      crlf = "\r\n";
#else
      crlf = "\n";
#endif   // WIN32
      strcat(strcpy(OutBuf, Tdbp->GetLine()), crlf);
      len = strlen(OutBuf);
    } else {
      if (fseek(Stream, Fpos, SEEK_SET)) {   // Fpos is last position
        sprintf(g->Message, MSG(FSETPOS_ERROR), 0);
        return RC_FX;
        } // endif fseek

      // Replace the line inside read buffer (length has not changed)
      memcpy(CurLine, Tdbp->GetLine(), strlen(Tdbp->GetLine()));
      OutBuf = CurLine;
      len = (size_t)(NxtLine - CurLine);
    } // endif UseTemp

    if (fwrite(OutBuf, 1, len, T_Stream) != (size_t)len) {
      sprintf(g->Message, MSG(FWRITE_ERROR), strerror(errno));
      return RC_FX;
      } // endif fwrite

    if (moved)
      if (fseek(Stream, curpos, SEEK_SET)) {
        sprintf(g->Message, MSG(FSEEK_ERROR), strerror(errno));
        return RC_FX;
        } // endif

  } // endif Mode

  return RC_OK;
  } // end of WriteBuffer
Пример #13
0
void TradeActor::Process(void)
{
	

 	if (m_curAction) 
	{
		m_curAction->Process();

		
		if (m_curAction->Finished()) 
		{
			MapPoint  end;
			m_curAction->GetEndMapPoint(end);
			if (end.x != 0 || end.y != 0) 
			{
				m_currentPos = end;
			}

			GetNextAction();
		}
	}

	if (m_curAction != NULL) {
		sint32 x, y;

		
		
		
	
		if(m_curAction->GetCurrentEndCondition() == ACTIONEND_INTERRUPT && 	m_curAction->LoopAnimHasCycled())
		{
			m_curAction->ResetAnimLoop();
			m_curAction->SetCurActionCounter(0);
			m_currentPos = GetNextPos();

			
			
			
			
			
			MapPoint tempDestPos = LookAtNextPos();
			MapPoint tempCurPos = m_currentPos;

			
			m_curAction->CreatePath(m_currentPos.x, m_currentPos.y, tempDestPos.x, tempDestPos.y);

		}
		
		maputils_MapXY2PixelXY(m_currentPos.x, m_currentPos.y, &x, &y);
		
		m_x = x;
		m_y = y;

		
		m_frame = m_curAction->GetSpriteFrame();

		
		m_transparency = m_curAction->GetTransparency();

		POINT curPt;

		
		if (m_curAction->GetPath() != NULL) {

			
			curPt = m_curAction->GetPosition();

			



			m_x = curPt.x;
			m_y = curPt.y;
		}
		
		m_facing = m_curAction->GetFacing();
	}
}
Пример #14
0
int JV3_libLoad_DiskFile(HXCFLOPPYEMULATOR* floppycontext,FLOPPY * floppydisk,char * imgfile,void * parameters)
{

	FILE * f;
	unsigned int filesize,cur_pos;
	unsigned int i,j,k,bitrate;
	unsigned short SectorSize, NumberofEntries;
	unsigned char  gap3len,interleave,StartIdSector;
	unsigned short rpm;
	unsigned char  trackformat;
	unsigned short sector_found;

	SECTORCONFIG*	sectorconfig;
	CYLINDER*		currentcylinder;

	JV3SectorHeader sh[JV3_HEADER_MAX];
	JV3SectorsOffsets *pOffset, *SectorsOffsets;
	unsigned char write_protected;
	unsigned int inc;

	floppycontext->hxc_printf(MSG_DEBUG,"JV3_libLoad_DiskFile %s",imgfile);

	f=hxc_fopen(imgfile,"rb");
	if(f==NULL)
	{
		floppycontext->hxc_printf(MSG_ERROR,"Cannot open %s !",imgfile);
		return HXCFE_ACCESSERROR;
	}

	fseek (f , 0 , SEEK_END);
	filesize=ftell(f);
	fseek (f , 0 , SEEK_SET);

	if(filesize!=0)
	{
		fread(sh, sizeof(JV3SectorHeader), JV3_HEADER_MAX, f);

		JV3_disk_geometry(sh, &floppydisk->floppyNumberOfSide, &floppydisk->floppySectorPerTrack, &floppydisk->floppyNumberOfTrack, &SectorSize, &StartIdSector, &NumberofEntries);
		
		fread(&write_protected, sizeof(write_protected), 1, f);                                                                         // just to jump this infomation


		SectorsOffsets = JV3_offset(sh, floppydisk->floppyNumberOfSide, floppydisk->floppySectorPerTrack, floppydisk->floppyNumberOfTrack, NumberofEntries, f);

		bitrate=250000;
		rpm=300;
		interleave=1;
		gap3len=255;
		trackformat=IBMFORMAT_SD;

		floppydisk->floppyBitRate=bitrate;
		floppydisk->floppyiftype=GENERIC_SHUGART_DD_FLOPPYMODE;
		floppydisk->tracks=(CYLINDER**)malloc(sizeof(CYLINDER*)*floppydisk->floppyNumberOfTrack);

		floppycontext->hxc_printf(MSG_DEBUG,"rpm %d bitrate:%d track:%d side:%d sector:%d",rpm,bitrate,floppydisk->floppyNumberOfTrack,floppydisk->floppyNumberOfSide,floppydisk->floppySectorPerTrack);

		sectorconfig=(SECTORCONFIG*)malloc(sizeof(SECTORCONFIG)*floppydisk->floppySectorPerTrack);
		memset(sectorconfig,0,sizeof(SECTORCONFIG)*floppydisk->floppySectorPerTrack);

		
		for(j=0;j<floppydisk->floppyNumberOfTrack;j++)
		{

			floppydisk->tracks[j]=allocCylinderEntry(rpm,floppydisk->floppyNumberOfSide);
			currentcylinder=floppydisk->tracks[j];

			for(i=0;i<floppydisk->floppyNumberOfSide;i++)
			{
				inc = 0;                                    // used to build track data
				memset(sectorconfig,0,sizeof(SECTORCONFIG)*floppydisk->floppySectorPerTrack);
				sector_found=0;

				cur_pos = GetFirstPos(SectorsOffsets,NumberofEntries,j,i);

				for(k=0;k<floppydisk->floppySectorPerTrack;k++)
				{
					pOffset = GetSectorPosition(SectorsOffsets,NumberofEntries,cur_pos);

		    		if (pOffset == NULL) 
					{
						inc += SectorSize;
					} 
					else 
					{
						
						sectorconfig[sector_found].sectorsize=pOffset->size;
						sectorconfig[sector_found].input_data=malloc(sectorconfig[sector_found].sectorsize);
						memset(sectorconfig[sector_found].input_data,0,sectorconfig[sector_found].sectorsize);

						fseek(f, pOffset->offset, SEEK_SET);
						fread(sectorconfig[sector_found].input_data,pOffset->size,1,f);
						
						inc += pOffset->size;
						
						if (pOffset->DAM != 0xFB) 
						{
							sectorconfig[sector_found].use_alternate_datamark=1;
							sectorconfig[sector_found].alternate_datamark=pOffset->DAM;
						}
						
						if(pOffset->density)
						{
							sectorconfig[sector_found].trackencoding=IBMFORMAT_DD;
							if(!sector_found) trackformat=IBMFORMAT_DD;
						}
						else
						{
							sectorconfig[sector_found].trackencoding=IBMFORMAT_SD;
							if(!sector_found) trackformat=IBMFORMAT_SD;
						}

						if(pOffset->bad_sector)
						{
							sectorconfig[sector_found].use_alternate_data_crc = 0x01;
							sectorconfig[sector_found].data_crc = 0xAA55;
						}

						sectorconfig[sector_found].cylinder = pOffset->track_id;
						sectorconfig[sector_found].head = i;
						sectorconfig[sector_found].sector = pOffset->sector_id;
						sectorconfig[sector_found].bitrate = floppydisk->floppyBitRate;
						sectorconfig[sector_found].gap3 = gap3len;

						sector_found++;

					}

					cur_pos = GetNextPos(SectorsOffsets,NumberofEntries,j,i,cur_pos);

				}
				currentcylinder->sides[i]=tg_generateTrackEx(sector_found,sectorconfig,interleave,0,floppydisk->floppyBitRate,rpm,trackformat,0,2500|NO_SECTOR_UNDER_INDEX,-2500);

				for(k=0;k<floppydisk->floppySectorPerTrack;k++)
				{
					free(sectorconfig[k].input_data);
				}

			}
		}

		free(sectorconfig);
		free(SectorsOffsets);
		floppycontext->hxc_printf(MSG_INFO_1,"track file successfully loaded and encoded!");

		hxc_fclose(f);

		hxcfe_sanityCheck(floppycontext,floppydisk);

		return HXCFE_NOERROR;
	}

	floppycontext->hxc_printf(MSG_ERROR,"file size=%d !?",filesize);
	hxc_fclose(f);
	return HXCFE_BADFILE;
}
Пример #15
0
void CRole::Update(float dt)
{

	m_oldPos = m_pos;
	CMoveableObj::Update(dt);

	/*
	m_mapPosX = (int)(m_pos.x/m_pMap->m_tileWidth);
	m_mapPosY = (int)(m_pos.y/m_pMap->m_tileHeight);
	if(m_mapPosX < 0 || m_mapPosY < 0 || 
		m_pos.x < 0 || m_pos.y < 0 ||
		m_mapPosX >= m_pMap->m_col || m_mapPosY >= m_pMap->m_row) 
	{//阻止角色离开地图
		m_pos = m_oldPos;
		SetStop();
	}

	if(m_pos==m_dst)
	{
		if(m_bSwt)
		{
			m_dst = m_fdst;
			ComputeDir();
			m_bSwt = false;
		}
		else if(m_bBeginFindPath)
		{
			Pos next;
			if(GetNextPos(&next, 
				(float)m_pMap->m_tileWidth/2, (float)m_pMap->m_tileHeight/2))
			{
				m_dst = next;
				if(next.x != m_pos.x && next.y != m_pos.y)//转折点
				{
					ComputeDir();
					m_bBeginFindPath = false;
					m_bSwt = true;//打开转折开关
					ClearPath();
				}

			}else
			{
				Stop();
				m_bBeginFindPath = false;
			}
		}else
		{
			Stop();
			m_bBeginFindPath = false;
		}
	}
	else
	{
		if(!m_pAni[m_dir]->IsPlaying())
		{
			m_pAni[m_dir]->Play();
			m_pAni[m_dir]->SetFrame(1);
		}
		m_bMoving = true;
	}

	if(CollideMap() && !m_bBeginFindPath && m_bMoving && !m_bSwt)
	{
		m_bBeginFindPath = true;
		//m_bSwt = false;
		m_pos = m_oldPos;

		int t=timeGetTime(); //计算寻路时间
		FindPath(&m_pos, &m_fdst);
		printf("寻路消耗时间: %d\n",timeGetTime()-t); //
		if(GetNextPos(&m_dst, (float)m_pMap->m_tileWidth/2, (float)m_pMap->m_tileHeight/2))
			ComputeDir();
		else
		{
			m_bBeginFindPath = false;
			SetStop();
		}
	}*/


	//test
	if(m_pos==m_dst)
	{
		if(GetNextPos(&m_dst, 
			(float)m_pMap->m_tileWidth/2, (float)m_pMap->m_tileHeight/2))
		{
			ComputeDir();
		}else
		{
			Stop();
			m_bBeginFindPath = false;
		}

	}
	else
	{
		if(!m_pAni[m_dir]->IsPlaying())
		{
			m_pAni[m_dir]->Play();
			m_pAni[m_dir]->SetFrame(1);
		}
		m_bMoving = true;
	}


	m_rect.x1 = m_pos.x - m_pMap->m_tileWidth/2.f +1;
	m_rect.y1 = m_pos.y - m_pMap->m_tileHeight/2.f +1;
	m_rect.x2 = m_pos.x + m_pMap->m_tileWidth/2.f-1;
	m_rect.y2 = m_pos.y + m_pMap->m_tileHeight/2.f -1;

	x1 = (int)(m_rect.x1/m_pMap->m_tileWidth);
	y1 = (int)(m_rect.y1/m_pMap->m_tileHeight);
	x2 = (int)(m_rect.x2/m_pMap->m_tileWidth);
	y2 = (int)(m_rect.y1/m_pMap->m_tileHeight);
	x3 = (int)(m_rect.x1/m_pMap->m_tileWidth);
	y3 = (int)(m_rect.y2/m_pMap->m_tileHeight);
	x4 = (int)(m_rect.x2/m_pMap->m_tileWidth);
	y4 = (int)(m_rect.y2/m_pMap->m_tileHeight);

	if(IsInMap(x1,y1))
		m_mapTile[INDEX(x1,y1)] = false;
	if(IsInMap(x2,y2))
		m_mapTile[INDEX(x2,y2)] = false;
	if(IsInMap(x3,y3))
		m_mapTile[INDEX(x3,y3)] = false;
	if(IsInMap(x4,y4))
		m_mapTile[INDEX(x4,y4)] = false;


	for(MOBJ_ITR itr = m_mobjs->begin(); itr != m_mobjs->end();itr ++)
	{
		hgeRect* rct = (*itr)->GetRect();
		if(m_rect.Intersect(rct))
		{
			if((*itr)->GetID() != m_uID)
			{
				//m_pos = m_oldPos;
				//Stop();
				//x1 = (int)(m_rect.x1/m_pMap->m_tileWidth);
				//y1 = (int)(m_rect.y1/m_pMap->m_tileHeight);
				//x2 = (int)(m_rect.x2/m_pMap->m_tileWidth);
				//y2 = (int)(m_rect.y1/m_pMap->m_tileHeight);
				//x3 = (int)(m_rect.x1/m_pMap->m_tileWidth);
				//y3 = (int)(m_rect.y2/m_pMap->m_tileHeight);
				//x4 = (int)(m_rect.x2/m_pMap->m_tileWidth);
				//y4 = (int)(m_rect.y2/m_pMap->m_tileHeight);
				//if(IsInMap(x1,y1))
				//	point1 = m_mapTile[INDEX(x1,y1)];
				//if(IsInMap(x2,y2))
				//	point2 = m_mapTile[INDEX(x2,y2)];
				//if(IsInMap(x3,y3))
				//	point3 = m_mapTile[INDEX(x3,y3)];
				//if(IsInMap(x4,y4))
				//	point4 = m_mapTile[INDEX(x4,y4)];

				//if(IsInMap(x1,y1))
				//	m_mapTile[INDEX(x1,y1)] = false;
				//if(IsInMap(x2,y2))
				//	m_mapTile[INDEX(x2,y2)] = false;
				//if(IsInMap(x3,y3))
				//	m_mapTile[INDEX(x3,y3)] = false;
				//if(IsInMap(x4,y4))
				//	m_mapTile[INDEX(x4,y4)] = false;
				//
				////m_bBeginFindPath = true;

				FindPath(&m_pos, &m_fdst);

				if(GetNextPos(&m_dst, (float)m_pMap->m_tileWidth/2, (float)m_pMap->m_tileHeight/2))
					ComputeDir();
				else
				{
					//m_bBeginFindPath = false;
					SetStop();
				}

				//if(IsInMap(x1,y1))
				//	m_mapTile[INDEX(x1,y1)] = point1;
				//if(IsInMap(x2,y2))
				//	m_mapTile[INDEX(x2,y2)] = point2;
				//if(IsInMap(x3,y3))
				//	m_mapTile[INDEX(x3,y3)] = point3;
				//if(IsInMap(x4,y4))
				//	m_mapTile[INDEX(x4,y4)] = point4;
				//

				break;
			}
			
		}
	}

	m_pAni[m_dir]->Update(dt);

}
Пример #16
0
//蛇更新位置
void CSnakeGame::SnakeMove()
{
	PLAY_EFFECT(EFFECT_WALL);

	//记录最后一个节点位置,因为可能需要增加节点
	int iNodeCount = m_mapSnakeNodes.size();
	POSITION stLastPos = m_mapSnakeNodes[iNodeCount - 1];

	//获取头部下个位置
	POSITION stHeaderPos = m_mapSnakeNodes[0];
	GetNextPos(stHeaderPos);

	if (CheckGameOver(stHeaderPos))
	{
		//设置结束状态
		m_enGameState = GAMESTATE_OVER;

		//设置苹果显示状态
		m_bAppleState = true;

		//音效
		PLAY_EFFECT(EFFECT_BOOM);
		return;
	}

	//更新其他节点
	for (int i = iNodeCount - 2; i >= 0; --i)
	{
		POSITION& stSrcPos = m_mapSnakeNodes[i + 1];
		const POSITION& stDestPos = m_mapSnakeNodes[i];
		stSrcPos.m_iRowIdx = stDestPos.m_iRowIdx;
		stSrcPos.m_iColIdx = stDestPos.m_iColIdx;
	}

	//头部位置更新
	m_mapSnakeNodes[0] = stHeaderPos;

	//检查头部位置是否是苹果的位置
	if (stHeaderPos == m_stApplePos)
	{
		//加分
		m_iScore += SNAKE_EAT_ADD_SCORE;
		m_pGameScene->UpdateScore(m_iScore);

		//增加节点
		m_mapSnakeNodes[iNodeCount] = stLastPos;

		//检查是否通过
		/*if (iNodeCount + 1 == SNAKE_MAX_LEN)
		{
			m_enGameState = GAMESTATE_PASS;
			return;
		}*/

		//苹果不显示
		m_pGameScene->UpdateBrick(m_stApplePos.m_iRowIdx, m_stApplePos.m_iColIdx, false, false);

		//重新随机苹果位置
		RandApplePos();
	}
}
Пример #17
0
int DOSFAM::DeleteRecords(PGLOBAL g, int irc)
  {
  bool moved;
  int curpos = ftell(Stream);

  /*********************************************************************/
  /*  There is an alternative here:                                    */
  /*  1 - use a temporary file in which are copied all not deleted     */
  /*      lines, at the end the original file will be deleted and      */
  /*      the temporary file renamed to the original file name.        */
  /*  2 - directly move the not deleted lines inside the original      */
  /*      file, and at the end erase all trailing records.             */
  /*  This will be experimented, but method 1 must be used for Unix as */
  /*  the function needed to erase trailing records is not available.  */
  /*********************************************************************/
  if (trace)
    htrc(
  "DOS DeleteDB: rc=%d UseTemp=%d curpos=%d Fpos=%d Tpos=%d Spos=%d\n",
                irc, UseTemp, curpos, Fpos, Tpos, Spos);

  if (irc != RC_OK) {
    /*******************************************************************/
    /*  EOF: position Fpos at the end-of-file position.                */
    /*******************************************************************/
    fseek(Stream, 0, SEEK_END);
    Fpos = ftell(Stream);

    if (trace)
      htrc("Fpos placed at file end=%d\n", Fpos);

    } // endif irc

  if (Tpos == Spos) {
    /*******************************************************************/
    /*  First line to delete, Open temporary file.                     */
    /*******************************************************************/
    if (UseTemp) {
      if (OpenTempFile(g))
        return RC_FX;

    } else {
      /*****************************************************************/
      /*  Move of eventual preceeding lines is not required here.      */
      /*  Set the target file as being the source file itself.         */
      /*  Set the future Tpos, and give Spos a value to block copying. */
      /*****************************************************************/
      T_Stream = Stream;
      Spos = Tpos = Fpos;
    } // endif UseTemp

    } // endif Tpos == Spos

  /*********************************************************************/
  /*  Move any intermediate lines.                                     */
  /*********************************************************************/
  if (MoveIntermediateLines(g, &moved))
    return RC_FX;

  if (irc == RC_OK) {
    /*******************************************************************/
    /*  Reposition the file pointer and set Spos.                      */
    /*******************************************************************/
    if (!UseTemp || moved)
      if (fseek(Stream, curpos, SEEK_SET)) {
        sprintf(g->Message, MSG(FSETPOS_ERROR), 0);
        return RC_FX;
        } // endif

    Spos = GetNextPos();                     // New start position

    if (trace)
      htrc("after: Tpos=%d Spos=%d\n", Tpos, Spos);

  } else {
    /*******************************************************************/
    /*  Last call after EOF has been reached.                          */
    /*  The UseTemp case is treated in CloseTableFile.                 */
    /*******************************************************************/
    if (!UseTemp) {
      /*****************************************************************/
      /*  Because the chsize functionality is only accessible with a   */
      /*  system call we must close the file and reopen it with the    */
      /*  open function (_fopen for MS ??) this is still to be checked */
      /*  for compatibility with Text files and other OS's.            */
      /*****************************************************************/
      char filename[_MAX_PATH];
      int  h;                           // File handle, return code

      PlugSetPath(filename, To_File, Tdbp->GetPath());
      /*rc=*/ PlugCloseFile(g, To_Fb);

      if ((h= global_open(g, MSGID_OPEN_STRERROR, filename, O_WRONLY)) <= 0)
        return RC_FX;

      /*****************************************************************/
      /*  Remove extra records.                                        */
      /*****************************************************************/
#if defined(UNIX)
      if (ftruncate(h, (off_t)Tpos)) {
        sprintf(g->Message, MSG(TRUNCATE_ERROR), strerror(errno));
        close(h);
        return RC_FX;
        } // endif
#else
      if (chsize(h, Tpos)) {
        sprintf(g->Message, MSG(CHSIZE_ERROR), strerror(errno));
        close(h);
        return RC_FX;
        } // endif
#endif

      close(h);

      if (trace)
        htrc("done, h=%d irc=%d\n", h, irc);

      } // endif !UseTemp

  } // endif irc

  return RC_OK;                                      // All is correct
  } // end of DeleteRecords
Пример #18
0
//---------------------------------------------------//
// TreeView_mHpProcess
//---------------------------------------------------//
void TreeView_mHpProcess(HWND hWndActive,BOOL &bChangeWnd,int iCurrentWnd,int iCountWnd)
{	switch(GetmHpVarStruct()->CourantTask->GetmHpStep())
	{	case 2: // 1° CLICK
		{	EndObjects(hWndActive);
			GetmHpVarStruct()->bRefreshDDraw=TRUE;
			SetDDrawObj(hWndActive,7);
			if(!DoInit(hWndActive)) StopmHelp(hWndActive,TRUE,TRUE);
			else SetTimer(hWndActive,ID_TIMER_DDRAW,1,(TIMERPROC)mHpTimerProc);
			break;
		}
		case 3: // DELAY
		{	PlayResourceWAV(MAKEINTRESOURCE(IDR_WAVE_PRESS));
			SetTimer(hWndActive,ID_TIMER_DELAI,50,(TIMERPROC)mHpTimerProc);
			break;
		}
		case 4: // UNCLICK + Selection
		{	PlayResourceWAV(MAKEINTRESOURCE(IDR_WAVE_UNPRESS));
			EndObjects(hWndActive);
			if(GetFocus()!=GetmHpVarStruct()->hWndCurCtrl) SetFocus(GetmHpVarStruct()->hWndCurCtrl);
			TreeView_SelectItem(GetmHpVarStruct()->hWndCurCtrl,hCurSelItm);
			GetmHpVarStruct()->bRefreshDDraw=TRUE;
			SetDDrawObj(hWndActive,0);
			if(!DoInit(hWndActive)) StopmHelp(hWndActive,TRUE,TRUE);
			else SetTimer(hWndActive,ID_TIMER_DDRAW,1,(TIMERPROC)mHpTimerProc);
			break;
		}
		case 5: // DELAY
		{	SetTimer(hWndActive,ID_TIMER_DELAI,1,(TIMERPROC)mHpTimerProc);
			break;
		}
		case 6: // 2° CLICK
		{	EndObjects(hWndActive);
			GetmHpVarStruct()->bRefreshDDraw=TRUE;
			SetDDrawObj(hWndActive,8);
			if(!DoInit(hWndActive)) StopmHelp(hWndActive,TRUE,TRUE);
			else SetTimer(hWndActive,ID_TIMER_DDRAW,1,(TIMERPROC)mHpTimerProc);
			break;
		}
		case 7: // DELAY
		{	PlayResourceWAV(MAKEINTRESOURCE(IDR_WAVE_PRESS));
			SetTimer(hWndActive,ID_TIMER_DELAI,50,(TIMERPROC)mHpTimerProc);
			break;
		}
		case 8: // UNCLICK + Expand
		{	PlayResourceWAV(MAKEINTRESOURCE(IDR_WAVE_UNPRESS));
			TreeView_Expand(GetmHpVarStruct()->hWndCurCtrl,hCurSelItm,TVE_EXPAND);
			EndObjects(hWndActive);
			GetmHpVarStruct()->bRefreshDDraw=TRUE;
			SetDDrawObj(hWndActive,0);
			if(!DoInit(hWndActive)) StopmHelp(hWndActive,TRUE,TRUE);
			else SetTimer(hWndActive,ID_TIMER_DDRAW,1,(TIMERPROC)mHpTimerProc);
			break;
		}
		case 9: // DELAY
		{	SetTimer(hWndActive,ID_TIMER_DELAI,400,(TIMERPROC)mHpTimerProc);
			break;
		}
		case 10: // NEXT SELECTION
		{	GetmHpVarStruct()->SelItemListe->ItemIndexSuivant();
			hCurSelItm=GetNexthTreeItemToSel(GetmHpVarStruct()->hWndCurCtrl,TreeView_GetChild(GetmHpVarStruct()->hWndCurCtrl,hCurSelItm));
			if(hCurSelItm!=NULL)
			{	RECT CtlRct;
			    GetWindowRect(GetmHpVarStruct()->hWndCurCtrl,&CtlRct);
				GetmHpVarStruct()->bRefreshDDraw=TRUE;
				GetmHpVarStruct()->bNewDepl=TRUE;
				RECT ItmRct;
			    TreeView_GetItemRect(GetmHpVarStruct()->hWndCurCtrl,hCurSelItm,&ItmRct,TRUE);
				ListTreeStatusPos(hWndActive,ItmRct);
				if(!GetmHpVarStruct()->AscensSens)
				{	// When the last visible item is selected, that launch an auto-scroll
					TreeView_EnsureVisible(GetmHpVarStruct()->hWndCurCtrl,hCurSelItm);
					TreeView_GetItemRect(GetmHpVarStruct()->hWndCurCtrl,hCurSelItm,&ItmRct,TRUE);
					//
					GetmHpVarStruct()->YnextPos=(int)(CtlRct.top+((ItmRct.bottom-ItmRct.top)/2)+ItmRct.top);
					GetmHpVarStruct()->XnextPos=(int)(CtlRct.left+((ItmRct.right-ItmRct.left)/2)+ItmRct.left);
					// DoubleClick | Click
					if(GetmHpVarStruct()->SelItemListe->IsNextIndexExist()) GetmHpVarStruct()->CourantTask->SetmHpStep(1);
				}
				else MoveOnScrollBar(GetmHpVarStruct()->hWndCurCtrl,CtlRct); // Not visible
				SetTimer(hWndActive,ID_TIMER_DDRAW,1,(TIMERPROC)mHpTimerProc);
			}
			else // END
			{	GetmHpVarStruct()->CourantTask->SetmHpStep(14);
				SetTimer(hWndActive,ID_TIMER_DELAI,1,(TIMERPROC)mHpTimerProc);
			}
			break;
		}
		case 11: // CLICK
		{	GetmHpVarStruct()->bRefreshDDraw=TRUE;
			SetDDrawObj(hWndActive,0);
			GetmHpVarStruct()->CursorType=1;
			SetTimer(hWndActive,ID_TIMER_DDRAW,1,(TIMERPROC)mHpTimerProc);
			break;
		}
		case 12: // DELAY
		{	PlayResourceWAV(MAKEINTRESOURCE(IDR_WAVE_PRESS));
			SetTimer(hWndActive,ID_TIMER_DELAI,150,(TIMERPROC)mHpTimerProc);
			break;
		}
		case 13: // LAST SELECTION
		{	RECT ctlRct;
			RECT itmRct;
			int iLastAscens;
			if(!GetmHpVarStruct()->AscensSens)
			{	PlayResourceWAV(MAKEINTRESOURCE(IDR_WAVE_UNPRESS));
				EndObjects(hWndActive);
				if(GetFocus()!=GetmHpVarStruct()->hWndCurCtrl) SetFocus(GetmHpVarStruct()->hWndCurCtrl);
				TreeView_SelectItem(GetmHpVarStruct()->hWndCurCtrl,hCurSelItm);
				GetmHpVarStruct()->bRefreshDDraw=TRUE;
				SetDDrawObj(hWndActive,0);
				GetmHpVarStruct()->CourantTask->SetmHpStep(14);
				if(!DoInit(hWndActive)) StopmHelp(hWndActive,TRUE,TRUE);
				else SetTimer(hWndActive,ID_TIMER_DDRAW,1,(TIMERPROC)mHpTimerProc);
			}
			else
			{	switch(GetmHpVarStruct()->AscensSens)
				{	case 1: // UP
				    {	if(!RestoreBackBuffer(hWndActive)) StopmHelp(hWndActive,TRUE,TRUE);
                        else
                        {   UpdateBackBuffer(TRUE);
						    SendMessage(GetmHpVarStruct()->hWndCurCtrl,WM_VSCROLL,
									    MAKEWPARAM(SB_THUMBPOSITION,(GetScrollPos(GetmHpVarStruct()->hWndCurCtrl,SB_VERT)-1)),NULL);
                            if(!UpdateFrame(hWndActive)) StopmHelp(hWndActive,TRUE,TRUE);
                        }
						break;
					}
					case 2: // DOWN
				    {	if(!RestoreBackBuffer(hWndActive)) StopmHelp(hWndActive,TRUE,TRUE);
                        else
                        {   UpdateBackBuffer(TRUE);
						    SendMessage(GetmHpVarStruct()->hWndCurCtrl,WM_VSCROLL,
									    MAKEWPARAM(SB_THUMBPOSITION,(GetScrollPos(GetmHpVarStruct()->hWndCurCtrl,SB_VERT)+1)),NULL);
                            if(!UpdateFrame(hWndActive)) StopmHelp(hWndActive,TRUE,TRUE);
                        }
						break;
					}
					case 3: // RIGHT
				    {	if(!RestoreBackBuffer(hWndActive)) StopmHelp(hWndActive,TRUE,TRUE);
                        else
                        {   UpdateBackBuffer(TRUE);
						    SendMessage(GetmHpVarStruct()->hWndCurCtrl,WM_HSCROLL,
									    MAKEWPARAM(SB_THUMBPOSITION,(GetScrollPos(GetmHpVarStruct()->hWndCurCtrl,SB_HORZ)+1)),NULL);
                            if(!UpdateFrame(hWndActive)) StopmHelp(hWndActive,TRUE,TRUE);
                        }
						break;
					}
					case 4: // LEFT
				    {	if(!RestoreBackBuffer(hWndActive)) StopmHelp(hWndActive,TRUE,TRUE);
                        else
                        {   UpdateBackBuffer(TRUE);
						    SendMessage(GetmHpVarStruct()->hWndCurCtrl,WM_HSCROLL,
									    MAKEWPARAM(SB_THUMBPOSITION,(GetScrollPos(GetmHpVarStruct()->hWndCurCtrl,SB_HORZ)-1)),NULL);
                            if(!UpdateFrame(hWndActive)) StopmHelp(hWndActive,TRUE,TRUE);
                        }
						break;
					}
				}
				iLastAscens=GetmHpVarStruct()->AscensSens;
				GetWindowRect(GetmHpVarStruct()->hWndCurCtrl,&ctlRct);
				TreeView_GetItemRect(GetmHpVarStruct()->hWndCurCtrl,hCurSelItm,&itmRct,TRUE);
				ListTreeStatusPos(hWndActive,itmRct);
				if(!GetmHpVarStruct()->AscensSens)
				{	// When the last visible item is selected, that launch an auto-scroll
					TreeView_EnsureVisible(GetmHpVarStruct()->hWndCurCtrl,hCurSelItm);
					TreeView_GetItemRect(GetmHpVarStruct()->hWndCurCtrl,hCurSelItm,&itmRct,TRUE);
					//
					GetmHpVarStruct()->YnextPos=(int)(ctlRct.top+((itmRct.bottom-itmRct.top)/2)+itmRct.top);
					GetmHpVarStruct()->XnextPos=(int)(ctlRct.left+((itmRct.right-itmRct.left)/2)+itmRct.left);
					// DoubleClick | Click
					if(GetmHpVarStruct()->SelItemListe->IsNextIndexExist()) GetmHpVarStruct()->CourantTask->SetmHpStep(1);
					else GetmHpVarStruct()->CourantTask->SetmHpStep(10);
					PlayResourceWAV(MAKEINTRESOURCE(IDR_WAVE_UNPRESS));
					EndObjects(hWndActive);
					GetmHpVarStruct()->bRefreshDDraw=TRUE;
					GetmHpVarStruct()->bNewDepl=TRUE;
					SetDDrawObj(hWndActive,0);
					if(!DoInit(hWndActive)) StopmHelp(hWndActive,TRUE,TRUE);
					else SetTimer(hWndActive,ID_TIMER_DDRAW,1,(TIMERPROC)mHpTimerProc);
				}
				else // Not visible
				{	if(iLastAscens!=GetmHpVarStruct()->AscensSens)
					{	MoveOnScrollBar(GetmHpVarStruct()->hWndCurCtrl,ctlRct);
						GetmHpVarStruct()->CourantTask->SetmHpStep(10);
						PlayResourceWAV(MAKEINTRESOURCE(IDR_WAVE_UNPRESS));
						EndObjects(hWndActive);
						GetmHpVarStruct()->bRefreshDDraw=TRUE;
						GetmHpVarStruct()->bNewDepl=TRUE;
						SetDDrawObj(hWndActive,0);
						if(!DoInit(hWndActive)) StopmHelp(hWndActive,TRUE,TRUE);
						else SetTimer(hWndActive,ID_TIMER_DDRAW,1,(TIMERPROC)mHpTimerProc);
					}
					else
					{	GetmHpVarStruct()->CourantTask->SetmHpStep(12);
						SetTimer(hWndActive,ID_TIMER_DELAI,200,(TIMERPROC)mHpTimerProc);
					}
				}
			}
			break;
		}
		case 14:
		{	if((!bFindItm)&&(GetmHpVarStruct()->CourantTask->GetmHpOption()>=10)) ViewCtrlNotReadyMsg(hWndActive,4);
			else SetTimer(hWndActive,ID_TIMER_DELAI,300,(TIMERPROC)mHpTimerProc);
			break;
		}
		case 15:
		{	if(GetmHpVarStruct()->TaskList->NextCellule())
			{	GetmHpVarStruct()->bNewDepl=TRUE;
				SetDDrawObj(hWndActive,0);
				GetmHpVarStruct()->CourantTask=GetmHpVarStruct()->TaskList->GetCurrentTask();
				GetNextPos(hWndActive);
			}
			else NextRepeatAssistProc(hWndActive);
			break;
		}
		default: NULL;
	}
}