Ejemplo n.º 1
0
bool CPlayer::CanKillNow()
{
	DebugInfo("CanKillNow Start Socket=%d PID=%d",reinterpret_cast<int>(m_pClientSocket),m_PID);

	if ( m_pRoom )
	{
		if ( m_RoomID == m_pRoom->GetRoomID() )
		{
			if ( m_pTable )
			{
				if ( m_TableID == m_pTable->GetTableID() )
				{
					if ( m_pTable->GetTableState()==TABLE_ST_PLAYING && this->IsPlaying() )
					{
						return false;
					}
				}
				else
				{
					DebugError("CPlayer::CanKillNow PID=%d,TableID=%d",m_PID,m_TableID);
				}
			}
		}
		else
		{
			DebugError("CPlayer::CanKillNow PID=%d,RoomID=%d",m_PID,m_RoomID);
		}
	}

	DebugInfo("CanKillNow End Socket=%d PID=%d",reinterpret_cast<int>(m_pClientSocket),m_PID);

	return true;
}
Ejemplo n.º 2
0
	Eigen::Matrix4f MatrixFactory::createOrthoOffCenter
	(
		float left,
		float right,
		float bottom,
		float top,
		float near_plane,
		float far_plane,
		Handedness handedness
	) const
	{
		if (handedness == Handedness::RightHanded)
		{
		}
		else if (handedness == Handedness::LeftHanded)
		{
		}
		else
		{
			DebugError("Not implemented.");
		}

		DebugError("Not implemented.");
		return Eigen::Matrix4f::Identity();
	}
Ejemplo n.º 3
0
VOID
CVfrCompiler::UpdateInfoForDynamicOpcode (
  VOID
  )
{
  SIfrRecord          *pRecord;

  if (!gNeedAdjustOpcode) {
    return;
  }
  
  //
  // Base on the original offset info to update the record list.
  //
  if (!gCIfrRecordInfoDB.IfrAdjustDynamicOpcodeInRecords()) {
    DebugError (NULL, 0, 1001, "Error parsing vfr file", "Can find the offset in the record.");
  }

  //
  // Base on the opcode binary length to recalculate the offset for each opcode.
  //
  gCIfrRecordInfoDB.IfrAdjustOffsetForRecord();

  //
  // Base on the offset to find the binary address.
  //
  pRecord = gCIfrRecordInfoDB.GetRecordInfoFromOffset(gAdjustOpcodeOffset);
  while (pRecord != NULL) {
    pRecord->mIfrBinBuf = gCFormPkg.GetBufAddrBaseOnOffset(pRecord->mOffset);
    if (pRecord->mIfrBinBuf == NULL) {
      DebugError (NULL, 0, 0001, "Error parsing vfr file", " 0x%X. offset not allocated.", pRecord->mOffset);
    }
    pRecord = pRecord->mNext;
  }
}
Ejemplo n.º 4
0
VOID
CVfrCompiler::Compile (
  VOID
  )
{
  FILE  *pInFile    = NULL;
  CHAR8 *InFileName = NULL;
  INPUT_INFO_TO_SYNTAX InputInfo;

  if (!IS_RUN_STATUS(STATUS_PREPROCESSED)) {
    goto Fail;
  }

  InFileName = (mOptions.SkipCPreprocessor == TRUE) ? mOptions.VfrFileName : mOptions.PreprocessorOutputFileName;

  gCVfrErrorHandle.SetInputFile (InFileName);
  gCVfrErrorHandle.SetWarningAsError(mOptions.WarningAsError);

  if ((pInFile = fopen (LongFilePath (InFileName), "r")) == NULL) {
    DebugError (NULL, 0, 0001, "Error opening the input file", "%s", InFileName);
    goto Fail;
  }

  InputInfo.CompatibleMode = mOptions.CompatibleMode;
  if (mOptions.HasOverrideClassGuid) {
    InputInfo.OverrideClassGuid = &mOptions.OverrideClassGuid;
  } else {
    InputInfo.OverrideClassGuid = NULL;
  }

  if (VfrParserStart (pInFile, &InputInfo) != 0) {
    goto Fail;
  }

  fclose (pInFile);
  pInFile = NULL;

  if (gCFormPkg.HavePendingUnassigned () == TRUE) {
    gCFormPkg.PendingAssignPrintAll ();
    goto Fail;
  }

  SET_RUN_STATUS (STATUS_COMPILEED);
  return;

Fail:
  if (!IS_RUN_STATUS(STATUS_DEAD)) {
    DebugError (NULL, 0, 0003, "Error parsing", "compile error in file %s", InFileName);
    SET_RUN_STATUS (STATUS_FAILED);
  }
  if (pInFile != NULL) {
    fclose (pInFile);
  }
}
Ejemplo n.º 5
0
VOID
CVfrCompiler::GenRecordListFile (
  VOID
  )
{
  CHAR8  *InFileName = NULL;
  FILE   *pInFile    = NULL;
  FILE   *pOutFile   = NULL;
  CHAR8  LineBuf[MAX_VFR_LINE_LEN];
  UINT32 LineNo;

  InFileName = (mOptions.SkipCPreprocessor == TRUE) ? mOptions.VfrFileName : mOptions.PreprocessorOutputFileName;

  if (mOptions.CreateRecordListFile == TRUE) {
    if ((InFileName[0] == '\0') || (mOptions.RecordListFile[0] == '\0')) {
      return;
    }

    if ((pInFile = fopen (InFileName, "r")) == NULL) {
      DebugError (NULL, 0, 0001, "Error opening the input VFR preprocessor output file", InFileName);
      return;
    }

    if ((pOutFile = fopen (mOptions.RecordListFile, "w")) == NULL) {
      DebugError (NULL, 0, 0001, "Error opening the record list file", mOptions.RecordListFile);
      goto Err1;
    }

    fprintf (pOutFile, "//\n//  VFR compiler version " VFR_COMPILER_VERSION __BUILD_VERSION "\n//\n");
    LineNo = 0;
    while (!feof (pInFile)) {
      if (fgets (LineBuf, MAX_VFR_LINE_LEN, pInFile) != NULL) {
        fprintf (pOutFile, "%s", LineBuf);
        LineNo++;
        gCIfrRecordInfoDB.IfrRecordOutput (pOutFile, LineNo);
      }
    }
    
    fprintf (pOutFile, "\n//\n// All Opcode Record List \n//\n");
    gCIfrRecordInfoDB.IfrRecordOutput (pOutFile, 0);
    gCVfrVarDataTypeDB.Dump(pOutFile);

    fclose (pOutFile);
    fclose (pInFile);
  }

  return;

Err1:
  fclose (pInFile);
}
Ejemplo n.º 6
0
Archivo: vfbn2.c Proyecto: burnmg/vfml
static void _InitializeGlobals(int argc, char *argv[]) {
   char fileName[255];

   _processArgs(argc, argv);

   MSetAllocFailFunction(_AllocFailed);   

   if(gUseStartingNet) {
      gPriorNet = BNReadBIF(gStartingNetFile);
      if(gPriorNet == 0) {
         DebugError(1, "couldn't read net specified by -startFrom\n");
      }

      gEs = BNGetExampleSpec(gPriorNet);
   } else {
      sprintf(fileName, "%s/%s.names", gSourceDirectory, gFileStem);
      gEs = ExampleSpecRead(fileName);
      DebugError(gEs == 0, "Unable to open the .names file");

      gPriorNet = BNNewFromSpec(gEs);
   }

   gInitialParameterCount = BNGetNumParameters(gPriorNet);
   gBranchFactor = BNGetNumNodes(gPriorNet) * BNGetNumNodes(gPriorNet);
   if(gLimitBytes != -1) {
      gMaxBytesPerModel = gLimitBytes / BNGetNumNodes(gPriorNet);
      //gMaxBytesPerModel = gLimitBytes / gBranchFactor;
      DebugMessage(1, 2, "Limit models to %.4lf megs\n", 
                     gMaxBytesPerModel / (1024.0 * 1024.0));
   }

   gCurrentNet = BNClone(gPriorNet);
   BNZeroCPTs(gCurrentNet);

   RandomInit();
   /* seed */
   if(gSeed != -1) {
      RandomSeed(gSeed);
   } else {
      gSeed = RandomRange(1, 30000);
      RandomSeed(gSeed);
   }

   DebugMessage(1, 1, "running with seed %d\n", gSeed);
   DebugMessage(1, 1, "allocation %ld\n", MGetTotalAllocation());
   DebugMessage(1, 1, "initial parameters %ld\n", gInitialParameterCount);

}
Ejemplo n.º 7
0
VOID
CVfrCompiler::AppendIncludePath (
  IN CHAR8      *PathStr
  )
{
  UINT32  Len           = 0;
  CHAR8   *IncludePaths = NULL;

  Len = strlen (" -I ") + strlen (PathStr) + 1;
  if (mOptions.IncludePaths != NULL) {
    Len += strlen (mOptions.IncludePaths);
  }
  IncludePaths = new CHAR8[Len];
  if (IncludePaths == NULL) {
    DebugError (NULL, 0, 4001, "Resource: memory can't be allocated", NULL);
    return;
  }
  IncludePaths[0] = '\0';
  if (mOptions.IncludePaths != NULL) {
    strcat (IncludePaths, mOptions.IncludePaths);
  }
  strcat (IncludePaths, " -I ");
  strcat (IncludePaths, PathStr);
  if (mOptions.IncludePaths != NULL) {
    delete mOptions.IncludePaths;
  }
  mOptions.IncludePaths = IncludePaths;
}
Ejemplo n.º 8
0
void ThreadResult::reportErr(const ErrorLogger::ErrorMessage &msg)
{
    QMutexLocker locker(&mutex);

    QList<unsigned int> lines;
    QStringList files;

    for (std::list<ErrorLogger::ErrorMessage::FileLocation>::const_iterator tok = msg._callStack.begin();
         tok != msg._callStack.end();
         ++tok)
    {
        files << QString((*tok).getfile(false).c_str());
        lines << (*tok).line;
    }

    ErrorItem item;
    item.file = QString(callStackToString(msg._callStack).c_str());
    item.files = files;
    item.id = QString(msg._id.c_str());
    item.lines = lines;
    item.summary = QString::fromStdString(msg.shortMessage());
    item.message = QString::fromStdString(msg.verboseMessage());
    item.severity = msg._severity;
    item.inconclusive = msg._inconclusive;

    if (msg._severity != Severity::debug)
        emit Error(item);
    else
        emit DebugError(item);
}
Ejemplo n.º 9
0
void __cdecl My_Sys_SetModuleOffset(char* moduleName, void* offset) {
    // We should be getting qagame, but check just in case.
    if (!strcmp(moduleName, "qagame")) {
        // Despite the name, it's not the actual module, but vmMain.
        // We use dlinfo to get the base of the module so we can properly
        // initialize all the pointers relative to the base.
    	qagame_dllentry = offset;

        Dl_info dlinfo;
        int res = dladdr(offset, &dlinfo);
        if (!res) {
            DebugError("dladdr() failed.\n", __FILE__, __LINE__, __func__);
            qagame = NULL;
        }
        else {
            qagame = dlinfo.dli_fbase;
        }
        DebugPrint("Got qagame: %#010x\n", qagame);
    }
    else
        DebugPrint("Unknown module: %s\n", moduleName);
    
    Sys_SetModuleOffset(moduleName, offset);
    if (common_initialized) {
    	SearchVmFunctions();
    	HookVm();
    	InitializeVm();
    }
}
Ejemplo n.º 10
0
CReal Besseli(const CReal rNu, const CReal rZ)
{
	const CReal	rEp = (CReal) 10e-9; /* Define accuracy */
	const CReal	rY = rZ / (CReal) 2.0;
	CReal		rReturn = (CReal) 1.0;
	CReal		rD = (CReal) 1.0;
	CReal		rS = (CReal) 1.0;

#ifdef _DEBUG_
	/* Only nu = 0 is supported right now! */
	if (rNu != (CReal) 0.0)
	{
		DebugError("MatLibr: Besseli function", "The nu = ", rNu, \
			" is not supported, only nu = ", 0);
	}
#endif

	for (int i = 1; i <= 25 && rReturn * rEp <= rS; i++)
	{
		rD *= rY / i;
		rS = rD * rD;
		rReturn += rS;
	}

	return rReturn;
}
Ejemplo n.º 11
0
VOID
CVfrCompiler::GenBinary (
  VOID
  )
{
  FILE                    *pFile = NULL;

  if (!IS_RUN_STATUS(STATUS_COMPILEED)) {
    goto Fail;
  }

  if (mOptions.CreateIfrPkgFile == TRUE) {
    if ((pFile = fopen (mOptions.PkgOutputFileName, "wb")) == NULL) {
      DebugError (NULL, 0, 0001, "Error opening file", mOptions.PkgOutputFileName);
      goto Fail;
    }
    if (gCFormPkg.BuildPkg (pFile, &gRBuffer) != VFR_RETURN_SUCCESS) {
      fclose (pFile);
      goto Fail;
    }
    fclose (pFile);
  }

  SET_RUN_STATUS (STATUS_GENBINARY);

  return;

Fail:
  if (!IS_RUN_STATUS(STATUS_DEAD)) {
    SET_RUN_STATUS (STATUS_FAILED);
  }
}
Ejemplo n.º 12
0
VOID
CVfrCompiler::AppendCPreprocessorOptions (
  IN CHAR8      *Options
  )
{
  UINT32  Len           = 0;
  CHAR8   *Opt          = NULL;

  Len = strlen (Options) + strlen (" ") + 1;
  if (mOptions.CPreprocessorOptions != NULL) {
    Len += strlen (mOptions.CPreprocessorOptions);
  }
  Opt = new CHAR8[Len];
  if (Opt == NULL) {
    DebugError (NULL, 0, 4001, "Resource: memory can't be allocated", NULL);
    return;
  }
  Opt[0] = 0;
  if (mOptions.CPreprocessorOptions != NULL) {
    strcat (Opt, mOptions.CPreprocessorOptions);
  }
  strcat (Opt, " ");
  strcat (Opt, Options);
  if (mOptions.CPreprocessorOptions != NULL) {
    delete mOptions.CPreprocessorOptions;
  }
  mOptions.CPreprocessorOptions = Opt;
}
Ejemplo n.º 13
0
int main(int argc, char *argv[]) {
   BeliefNet bn, cbn;
   FILE *dataFile;
   ExamplePtr e;
   long numSeen = 0;
   double llSum = 0;

   _processArgs(argc, argv);

   bn = _readBN(gBeliefNetFile);

   if(gDoSmooth) {
      BNSetPriorStrength(bn, gPriorStrength);
      BNSmoothProbabilities(bn, 1);
      if(DebugGetMessageLevel() > 2) {
         BNWriteBIF(bn, stdout);
      }
   }

   if(gCompareToNet) {
      cbn = _readBN(gCompareNetFile);

      if(gDoSmooth) {
         BNSetPriorStrength(cbn, gPriorStrength);
         BNSmoothProbabilities(cbn, 1);
      }

      DebugMessage(1, 0, "Structural Difference: %d\n",
         _GetStructuralDifference(bn, cbn));
      
   } else {
      if(gStdin) {
         dataFile = stdin;
      } else {
         dataFile = fopen(gDataFile, "r");
         DebugError(dataFile == 0, "Unable to open datafile.");
      }

      e = ExampleRead(dataFile, BNGetExampleSpec(bn));
      while(e != 0) {
         numSeen++;

         llSum += BNGetLogLikelihood(bn, e);

         ExampleFree(e);
         e = ExampleRead(dataFile, BNGetExampleSpec(bn));
      }

      DebugMessage(1, 1, "Average Log Likelihood of %s on %s is: ",
              gBeliefNetFile, gDataFile);
      DebugMessage(1, 0, "%lf\n", llSum / (double)numSeen);

      if(!gStdin) {
        fclose(dataFile);
      } 
   }

   return 0;
}
Ejemplo n.º 14
0
	Eigen::Matrix4f MatrixFactory::createOrtho
	(
		float width,
		float height,
		float near_plane,
		float far_plane,
		Handedness handedness
	) const
	{
		if (handedness == Handedness::RightHanded)
		{
			float h = height;
			float w = width;

			// z device coordinates [0, 1]
			float _33 = 1 / (near_plane - far_plane);
			float _34 = near_plane * _33;

			// z device coordinates [-1, 1]
			//float _33 = 2 / (near_plane - far_plane);
			//float _34 = (near_plane + far_plane) / (near_plane - far_plane);
			
			Eigen::Matrix4f matrix;
			matrix << 2/w, 0, 0, 0,
					  0, 2/h, 0, 0,
					  0, 0, _33, _34,
					  0, 0, 0, 1;
			
			return matrix;
		}
		else if (handedness == Handedness::LeftHanded)
		{
			float h = height;
			float w = width;

			// z device coordinates [0, 1]
			float _33 = 1 / (far_plane - near_plane);
			float _34 = -near_plane * _33;

			// z device coordinates [-1, 1]
			//float _33 = 2 / (far_plane - near_plane);
			//float _34 = -(near_plane + far_plane) / (far_plane - near_plane);
			
			Eigen::Matrix4f matrix;
			matrix << 2/w, 0, 0, 0,
					  0, 2/h, 0, 0,
					  0, 0, _33, _34,
					  0, 0, 0, 1;
			
			return matrix;
		}
		else
		{
			DebugError("Not implemented.");
			return Eigen::Matrix4f::Identity();
		}
	}
Ejemplo n.º 15
0
	Eigen::Matrix4f MatrixFactory::createPerspectiveFov
	(
		float near_plane,
		float far_plane,
		float aspect_ratio,
		float fov_vertical,
		Handedness handedness
	) const
	{
		if (handedness == Handedness::RightHanded)
		{
			float h = 1.0f / tan(fov_vertical / 2.0f);
			float w = h / aspect_ratio;

			// z device coordinates [0, 1]
			float _33 = far_plane / (near_plane - far_plane);
			float _34 = near_plane * _33;

			// z device coordinates [-1, 1]
			//float _33 = (near_plane + far_plane) / (near_plane - far_plane);
			//float _34 = (2 * near_plane * far_plane) / (near_plane - far_plane);
			
			Eigen::Matrix4f matrix;
			matrix << w, 0, 0, 0,
					  0, h, 0, 0,
					  0, 0, _33, _34,
					  0, 0, -1, 0;
			
			return matrix;
		}
		else if (handedness == Handedness::LeftHanded)
		{
			float h = 1.0f / tan(fov_vertical / 2.0f);
			float w = h / aspect_ratio;

			// z device coordinates [0, 1]
			float _33 = far_plane / (far_plane - near_plane);
			float _34 = -near_plane * _33;

			// z device coordinates [-1, 1]
			//float _33 = (near_plane + far_plane) / (far_plane - near_plane);
			//float _34 = -(2 * near_plane * far_plane) / (far_plane - near_plane);
			
			Eigen::Matrix4f matrix;
			matrix << w, 0, 0, 0,
					  0, h, 0, 0,
					  0, 0, _33, _34,
					  0, 0, 1, 0;
			
			return matrix;
		}
		else
		{
			DebugError("Not implemented.");
			return Eigen::Matrix4f::Identity();
		}
	}
Ejemplo n.º 16
0
VOID
CVfrCompiler::Compile (
  VOID
  )
{
  FILE  *pInFile    = NULL;
  CHAR8 *InFileName = NULL;

  if (!IS_RUN_STATUS(STATUS_PREPROCESSED)) {
    goto Fail;
  }

  InFileName = (mOptions.SkipCPreprocessor == TRUE) ? mOptions.VfrFileName : mOptions.PreprocessorOutputFileName;

  gCVfrErrorHandle.SetInputFile (InFileName);

  if ((pInFile = fopen (InFileName, "r")) == NULL) {
    DebugError (NULL, 0, 0001, "Error opening the input file", InFileName);
    goto Fail;
  }

  if (VfrParserStart (pInFile, mOptions.CompatibleMode) != 0) {
    goto Fail;
  }

  fclose (pInFile);

  if (gCFormPkg.HavePendingUnassigned () == TRUE) {
    gCFormPkg.PendingAssignPrintAll ();
    goto Fail;
  }

  SET_RUN_STATUS (STATUS_COMPILEED);
  return;

Fail:
  if (!IS_RUN_STATUS(STATUS_DEAD)) {
    DebugError (NULL, 0, 0003, "Error parsing", "compile error in file %s", InFileName);
    SET_RUN_STATUS (STATUS_FAILED);
  }
  if (pInFile != NULL) {
    fclose (pInFile);
  }
}
Ejemplo n.º 17
0
void CPlayer::AddMoGuiMoney(INT32 nMoney)
{
	if ( nMoney>=0 && m_nMoGuiMoney+nMoney>=0 )
	{
		m_nMoGuiMoney += nMoney;
	}
	else
	{
		DebugError("AddMoGuiMoney PID=%-10d m_nMoGuiMoney=%d nMoney=%d",m_PID,m_nMoGuiMoney,nMoney );
	}
}
Ejemplo n.º 18
0
	void chunk::create(){
		pblocks = new block[4096];
		pbrightness = new brightness[4096];
		//memset(pblocks, 0, sizeof(pblocks));
		//memset(pbrightness, 0, sizeof(pbrightness));
#ifdef NEWORLD_DEBUG_CONSOLE_OUTPUT
		if (pblocks == nullptr || pbrightness == nullptr){
			DebugError("Allocate memory failed!");
		}
#endif
	}
Ejemplo n.º 19
0
void CPlayer::OnDestroy(void)
{
	s_State[m_PlayerState]--;
	if ( s_State[m_PlayerState] < 0 )
	{
 		DebugError("OnDestroy State=%d stCount=%d",m_PlayerState,s_State[m_PlayerState]);
	}
	m_PlayerState = PLAYER_ST_NONE;

	RecyclePlayer(this);
}
Ejemplo n.º 20
0
void CPlayer::AddGameMoney(INT64 nMoney)
{
	DebugInfo("AddGameMoney PID=%d GameMoney=%s AddMoney=%s",m_PID,N2S(m_nGameMoney).c_str(),N2S(nMoney).c_str());

	m_nGameMoney += nMoney;
	if ( m_nGameMoney < 0 )
	{
		DebugError("AddGameMoney PID=%-10d m_nGameMoney=%s nMoney=%s",m_PID,Tool::N2S(m_nGameMoney).c_str(),Tool::N2S(nMoney).c_str() );

		m_nGameMoney = 0;		
	}
}
Ejemplo n.º 21
0
void CPlayer::DecGameMoney(INT64 nMoney)
{
	if ( nMoney>=0 && m_nGameMoney-nMoney>=0)
	{
		m_nGameMoney -= nMoney;
	}
	else
	{
		DebugError("DecGameMoney PID=%-10d m_nGameMoney=%s nMoney=%s",
			m_PID,Tool::N2S(m_nGameMoney).c_str(),Tool::N2S(nMoney).c_str() );
	}	
}
Ejemplo n.º 22
0
void CPlayer::AddMatchJF(INT64 nJF)
{
	if ( nJF>=0 )
	{
		m_nMatchJF += nJF;
	}
	else
	{
		DebugError("AddMatchJF PID=%d m_nMatchJF=%s nJF=%s",
			m_PID,Tool::N2S(m_nMatchJF).c_str(),Tool::N2S(nJF).c_str() );
	}
}
Ejemplo n.º 23
0
void CPlayer::AttachSocket( GameServerSocket* pcs )
{
	DebugInfo("AttachSocket Start old_Socket=%d new_Socket=%d",reinterpret_cast<int>(m_pClientSocket),reinterpret_cast<int>(pcs) );

	if ( pcs == m_pClientSocket && pcs )
	{
		DebugError("AttachSocket 相同的SOCKET pcs=%d",reinterpret_cast<int>(pcs) );
	}

	m_KillTime = 0;
	m_SocketCloseTime = 0;	
	m_mapRoomTime.clear();

	if( this->m_pClientSocket )
	{
		Game_MsgFlag msgFlag;
		msgFlag.m_Flag = msgFlag.LAND_OTHER_PLACE;
		msgFlag.m_nValue = pcs->GetPeerLongIp();
		this->m_pClientSocket->SendMsg(msgFlag);

		this->m_pClientSocket->SetPlayer(NULL);
		this->m_pClientSocket->Stop(GetCurTime());
		//this->m_pClientSocket->Close();
		//this->m_pClientSocket = NULL;
	}

	if( pcs && pcs->GetConnect() )
	{
		m_pClientSocket = pcs;
		pcs->SetPlayer(this);		
	}
	else
	{
		DebugError("CPlayer::Attach");
		assert(0);
	}

	DebugInfo("AttachSocket End");
}
Ejemplo n.º 24
0
	Eigen::Matrix4f MatrixFactory::createPerspective
	(
		float width,
		float height,
		float near_plane,
		float far_plane,
		Handedness handedness
	) const
	{
		if (handedness == Handedness::RightHanded)
		{
		}
		else if (handedness == Handedness::LeftHanded)
		{
		}
		else
		{
			DebugError("Not implemented.");
		}

		DebugError("Not implemented.");
		return Eigen::Matrix4f::Identity();
	}
Ejemplo n.º 25
0
void CPlayer::SetPlayerState( BYTE st )
{
	if( st != m_PlayerState )
	{
		s_State[m_PlayerState]--;
		s_State[st]++;

		if ( s_State[m_PlayerState]<0 || s_State[st]<=0 )
		{
			DebugError("PlayerState=%d st=%d pscount=%d stcount=%d",m_PlayerState,st,s_State[m_PlayerState],s_State[st]);
		}

		m_PlayerState = st;
	}
}
Ejemplo n.º 26
0
	void init(string ip, unsigned short _port) {
		Net::startup();

		try {
			socketClient.connectIPv4(ip, _port);
		}
		catch (...) {
			DebugError("Cannot connect to the server!");
			return;
		}

		threadRun = true;
		mutex = MutexCreate();
		t = ThreadCreate(networkThread, NULL);
	}
Ejemplo n.º 27
0
HashTable *HashTableNew(int size) {
   HashTable* table = NULL;
   int i = 0;

   table = MNewPtr(sizeof(HashTable));

   table->size = size;
   table->array = MNewPtr(sizeof(VoidListPtr) * size);

   for(i = 0; i < size; i++) {
      table->array[i] = VLNew();
      DebugError(table->array[i] == NULL, "Failed allocate in HashTableNew");
   }

   return table;
}
Ejemplo n.º 28
0
	Eigen::Matrix4f MatrixFactory::createLookAt
	(
		const Eigen::Vector3f& position,
		const Eigen::Vector3f& direction,
		const Eigen::Vector3f& world_up,
		Handedness handedness
	) const
	{
		if (handedness == Handedness::RightHanded)
		{
			Eigen::Vector3f right, up, dir;
			dir = -direction.normalized();
			right = world_up.normalized().cross(dir).normalized();
			up = dir.cross(right);

			Eigen::Matrix4f matrix;
			matrix << right.x(), right.y(), right.z(), -right.dot(position),
				      up.x(),    up.y(),    up.z(),    -up.dot(position),
				      dir.x(),   dir.y(),   dir.z(),   -dir.dot(position),
				      0.0f, 0.0f, 0.0f, 1.0f;

			return matrix;
		}
		else if (handedness == Handedness::LeftHanded)
		{
			Eigen::Vector3f right, up, dir;
			dir = direction.normalized();
			right = world_up.normalized().cross(dir).normalized();
			up = dir.cross(right);

			Eigen::Matrix4f matrix;
			matrix << right.x(), right.y(), right.z(), -right.dot(position),
				      up.x(),    up.y(),    up.z(),    -up.dot(position),
				      dir.x(),   dir.y(),   dir.z(),   -dir.dot(position),
				      0.0f, 0.0f, 0.0f, 1.0f;

			return matrix;
		}
		else
		{
			DebugError("Not implemented.");
			return Eigen::Matrix4f::Zero();
		}
	}
Ejemplo n.º 29
0
VOID
CVfrCompiler::GenCFile (
  VOID
  )
{
  FILE                    *pFile;
  UINT32                  Index;

  if (!IS_RUN_STATUS(STATUS_GENBINARY)) {
    goto Fail;
  }
  
  if (!mOptions.CreateIfrPkgFile || mOptions.CompatibleMode) {
    if ((pFile = fopen (mOptions.COutputFileName, "w")) == NULL) {
      DebugError (NULL, 0, 0001, "Error opening output C file", mOptions.COutputFileName);
      goto Fail;
    }

    for (Index = 0; gSourceFileHeader[Index] != NULL; Index++) {
      fprintf (pFile, "%s\n", gSourceFileHeader[Index]);
    }

    if (mOptions.CompatibleMode) { 
      gCVfrBufferConfig.OutputCFile (pFile, mOptions.VfrBaseFileName);
    }

    if (gCFormPkg.GenCFile (mOptions.VfrBaseFileName, pFile, &gRBuffer) != VFR_RETURN_SUCCESS) {
      fclose (pFile);
      goto Fail;
    }
    fclose (pFile);
  }

  SET_RUN_STATUS (STATUS_FINISHED);
  return;

Fail:
  if (!IS_RUN_STATUS(STATUS_DEAD)) {
    SET_RUN_STATUS (STATUS_FAILED);
  }
}
Ejemplo n.º 30
0
void *HashTableRemove(HashTable *table, int index,
		      int (*cmp)(const void *, const int)) {
   int i, found, foundIndex;
   VoidListPtr list;

   DebugError(index < 0, "Invalid index in HashTableRemove");

   list = table->array[index % (table->size)];

   found = 0;
   foundIndex = -1;
   for(i = 0 ; i < VLLength(list) && !found ; i++) {
      if((*cmp)(VLIndex(list, i), index) >= 0) {
         found = 1;
         foundIndex = i;
      }
   }

   if(found == 1) {
      return VLRemove(list, foundIndex);
   } else {
      return 0;
   }
}