void ReadParameters(int *xlength, float *tau, float *velocity_wall, int *timesteps, int *timesteps_per_plotting, int argc, char *argv[], int *gpu_enabled, int *gpu_streaming, int *gpu_collision, int *gpu_boundaries){ float *velocity_wall_1, *velocity_wall_2, *velocity_wall_3; if(argc<3) PrintHelpMessage(); if(!strcmp(argv[1], "-help") || !strcmp(argv[2], "-help")) PrintHelpMessage(); if(access(argv[1], R_OK) != 0) ERROR("Provided configuration file path either doesn't exist or can not be read."); if(!strcmp(argv[2], "-gpu")) *gpu_enabled=1; else *gpu_enabled=0; if(!strcmp(argv[2], "-gpu-streaming")) *gpu_streaming=1; else *gpu_streaming=0; if(!strcmp(argv[2], "-gpu-collision")) *gpu_collision=1; else *gpu_collision=0; if(!strcmp(argv[2], "-gpu-boundaries")) *gpu_boundaries=1; else *gpu_boundaries=0; READ_FLOAT(argv[1], *tau); velocity_wall_1=&velocity_wall[0]; velocity_wall_2=&velocity_wall[1]; velocity_wall_3=&velocity_wall[2]; READ_FLOAT(argv[1], *velocity_wall_1); READ_FLOAT(argv[1], *velocity_wall_2); READ_FLOAT(argv[1], *velocity_wall_3); READ_INT(argv[1], *xlength); READ_INT(argv[1], *timesteps); READ_INT(argv[1], *timesteps_per_plotting); }
//=============================================================================== void CreatorPassSkill::loadValues() { ///Open the paramater file: ///REMEMBER TO CHANGE THE PARAMETER TEXT FILE NAME TO THE APPROPRIATE NAME! ifstream mainFile; mainFile.open("Params/Skill_Params/CreatorPassSkillParams.txt", ios::nocreate); ASSERT(mainFile.fail() == 0, "CAN'T OPEN PARAMETER FILE!"); //Load parameter values. See params.h and params.cpp for good examples. //################ ADD PARAMETERS BELOW ################ READ_FLOAT(OFFSET); READ_FLOAT(MIN_WIDTH); READ_FLOAT(MAXIMUM_ANGLE); READ_FLOAT(FACTOR); READ_FLOAT(GOALIE_DISTANCE_THRESHOLD); READ_FLOAT(BOUND_FACTOR); READ_FLOAT(PASS_DIST); READ_FLOAT(CLOSE_BOUND); READ_FLOAT(MIN_DIST); READ_FLOAT(ANGLE_LIMIT); //################ ADD PARAMETERS ABOVE ################ mainFile.close(); }
//********************************************************* ///Reads in the values of the parameters from the plays's parameter text file. void DoublePickOffenseTransition::loadValues() { ///Open the paramater file: ifstream mainFile; mainFile.open("Params/Play_Params/playTransition/DoublePickOffenseTransitionParams.txt", ios::nocreate); ASSERT(mainFile.fail() == 0, "CAN'T OPEN PARAMETER FILE!"); //Load parameter values. See params.h and params.cpp for good examples. //################ ADD PARAMETERS BELOW ################ READ_FLOAT(MAX_ELAPSED_TIME); READ_FLOAT(FINISH_DIST); //################ ADD PARAMETERS ABOVE ################ mainFile.close(); }
//==================================== ///Reads in the values of the parameters from the plays's parameter text file. void PassingChallengePlay::loadValues() { ///Open the paramater file: ifstream mainFile; mainFile.open("Params/Play_Params/other/PassingChallengePlayParams.txt", ios::nocreate); ASSERT(mainFile.fail() == 0, "CAN'T OPEN PARAMETER FILE!"); ///Read the parameters READ_FLOAT(POINT_X); READ_FLOAT(POINT_Y); READ_FLOAT(ROTATION_THRESHOLD); READ_FLOAT(DISTANCE_THRESHOLD); READ_FLOAT(MAX_ELAPSED_TIME); }
thumb_stick::thumb_stick(std::vector<MGField>& fields) { BEGIN_READ_DEF; const char* stick_type; READ_STRING(stick_type); if (!strncmp(stick_type,"right",5)) { outputs[0] = ABS_RX; outputs[1] = ABS_RY; } else { outputs[0] = ABS_X; outputs[1] = ABS_Y; } READ_FLOAT(deadzone); READ_FLOAT(outzone); READ_FLOAT(angle_snap); }
static AnimNode::Pointer loadOverlayNode(const QJsonObject& jsonObj, const QString& id, const QUrl& jsonUrl) { READ_STRING(boneSet, jsonObj, id, jsonUrl, nullptr); READ_FLOAT(alpha, jsonObj, id, jsonUrl, nullptr); auto boneSetEnum = stringToBoneSetEnum(boneSet); if (boneSetEnum == AnimOverlay::NumBoneSets) { qCCritical(animation) << "AnimNodeLoader, unknown bone set =" << boneSet << ", defaulting to \"fullBody\""; boneSetEnum = AnimOverlay::FullBodyBoneSet; } READ_OPTIONAL_STRING(boneSetVar, jsonObj); READ_OPTIONAL_STRING(alphaVar, jsonObj); auto node = std::make_shared<AnimOverlay>(id, boneSetEnum, alpha); if (!boneSetVar.isEmpty()) { node->setBoneSetVar(boneSetVar); } if (!alphaVar.isEmpty()) { node->setAlphaVar(alphaVar); } return node; }
///Reads in the values of the parameters from the skill's parameter text file. void ThreeManSideSkill::loadValues() { ///Open the parameter file: ///REMEMBER TO CHANGE THE PARAMETER TEXT FILE NAME TO THE APPROPRIATE NAME! ifstream mainFile; mainFile.open("Params/Skill_Params/ThreeManSideSkillParams.txt", ios::nocreate); ASSERT(mainFile.fail() == 0, "CAN'T OPEN PARAMETER FILE!"); //Load parameter values. See params.h and params.cpp for good examples. //################ ADD PARAMETERS BELOW ################ READ_FLOAT(LINE_X_OFFSET); UPPER_X = sp->field.DEFENSE_ZONE_LINE + LINE_X_OFFSET; LOWER_X = sp->field.OUR_GOALIE_BOX + sp->general.PLAYER_RADIUS + LINE_X_OFFSET; READ_FLOAT(KICK_ANGLE); READ_FLOAT(KICK_DIST); //################ ADD PARAMETERS ABOVE ################ mainFile.close(); }
static AnimNode::Pointer loadTwoBoneIKNode(const QJsonObject& jsonObj, const QString& id, const QUrl& jsonUrl) { READ_FLOAT(alpha, jsonObj, id, jsonUrl, nullptr); READ_BOOL(enabled, jsonObj, id, jsonUrl, nullptr); READ_FLOAT(interpDuration, jsonObj, id, jsonUrl, nullptr); READ_STRING(baseJointName, jsonObj, id, jsonUrl, nullptr); READ_STRING(midJointName, jsonObj, id, jsonUrl, nullptr); READ_STRING(tipJointName, jsonObj, id, jsonUrl, nullptr); READ_VEC3(midHingeAxis, jsonObj, id, jsonUrl, nullptr); READ_STRING(alphaVar, jsonObj, id, jsonUrl, nullptr); READ_STRING(enabledVar, jsonObj, id, jsonUrl, nullptr); READ_STRING(endEffectorRotationVarVar, jsonObj, id, jsonUrl, nullptr); READ_STRING(endEffectorPositionVarVar, jsonObj, id, jsonUrl, nullptr); auto node = std::make_shared<AnimTwoBoneIK>(id, alpha, enabled, interpDuration, baseJointName, midJointName, tipJointName, midHingeAxis, alphaVar, enabledVar, endEffectorRotationVarVar, endEffectorPositionVarVar); return node; }
//=============================================================================== ///Reads in the values of the parameters from the skill's parameter text file. void RotateAroundBallSkill::loadValues() { ///Open the parameter file: ///REMEMBER TO CHANGE THE PARAMETER TEXT FILE NAME TO THE APPROPRIATE NAME! ifstream mainFile; mainFile.open("Params/Skill_Params/RotateAroundBallSkillParams.txt", ios::nocreate); ASSERT(mainFile.fail() == 0, "CAN'T OPEN PARAMETER FILE!"); //Load parameter values. See params.h and params.cpp for good examples. //################ ADD PARAMETERS BELOW ################ READ_FLOAT(ROTATION_STEP); ROTATION_STEP = ROTATION_STEP * PI; READ_FLOAT(FINISHED_ROTATION_THRESHOLD); READ_FLOAT(PUSH_FACTOR); READ_INT(USE_BALL_FOR_PIVOT); //################ ADD PARAMETERS ABOVE ################ mainFile.close(); }
static AnimNode::Pointer loadClipNode(const QJsonObject& jsonObj, const QString& id, const QUrl& jsonUrl) { READ_STRING(url, jsonObj, id, jsonUrl, nullptr); READ_FLOAT(startFrame, jsonObj, id, jsonUrl, nullptr); READ_FLOAT(endFrame, jsonObj, id, jsonUrl, nullptr); READ_FLOAT(timeScale, jsonObj, id, jsonUrl, nullptr); READ_BOOL(loopFlag, jsonObj, id, jsonUrl, nullptr); READ_OPTIONAL_BOOL(mirrorFlag, jsonObj, false); READ_OPTIONAL_STRING(startFrameVar, jsonObj); READ_OPTIONAL_STRING(endFrameVar, jsonObj); READ_OPTIONAL_STRING(timeScaleVar, jsonObj); READ_OPTIONAL_STRING(loopFlagVar, jsonObj); READ_OPTIONAL_STRING(mirrorFlagVar, jsonObj); // animation urls can be relative to the containing url document. auto tempUrl = QUrl(url); tempUrl = jsonUrl.resolved(tempUrl); auto node = std::make_shared<AnimClip>(id, tempUrl.toString(), startFrame, endFrame, timeScale, loopFlag, mirrorFlag); if (!startFrameVar.isEmpty()) { node->setStartFrameVar(startFrameVar); } if (!endFrameVar.isEmpty()) { node->setEndFrameVar(endFrameVar); } if (!timeScaleVar.isEmpty()) { node->setTimeScaleVar(timeScaleVar); } if (!loopFlagVar.isEmpty()) { node->setLoopFlagVar(loopFlagVar); } if (!mirrorFlagVar.isEmpty()) { node->setMirrorFlagVar(mirrorFlagVar); } return node; }
static AnimNode::Pointer loadBlendLinearNode(const QJsonObject& jsonObj, const QString& id, const QUrl& jsonUrl) { READ_FLOAT(alpha, jsonObj, id, jsonUrl, nullptr); READ_OPTIONAL_STRING(alphaVar, jsonObj); auto node = std::make_shared<AnimBlendLinear>(id, alpha); if (!alphaVar.isEmpty()) { node->setAlphaVar(alphaVar); } return node; }
//********************************************************* ///Reads in the values of the parameters from the plays's parameter text file. void PenaltyShotUsPivot2002Transition::loadValues() { ///Open the paramater file: ifstream mainFile; mainFile.open("Params/Play_Params/playTransition/PenaltyShotUsPivot2002TransitionParams.txt", ios::nocreate); ASSERT(mainFile.fail() == 0, "CAN'T OPEN PARAMETER FILE!"); //Load parameter values. See params.h and params.cpp for good examples. //################ ADD PARAMETERS BELOW ################ READ_FLOAT(TIMEOUT); //################ ADD PARAMETERS ABOVE ################ mainFile.close(); }
static AnimNode::Pointer loadBlendLinearMoveNode(const QJsonObject& jsonObj, const QString& id, const QUrl& jsonUrl) { READ_FLOAT(alpha, jsonObj, id, jsonUrl, nullptr); READ_FLOAT(desiredSpeed, jsonObj, id, jsonUrl, nullptr); std::vector<float> characteristicSpeeds; auto speedsValue = jsonObj.value("characteristicSpeeds"); if (!speedsValue.isArray()) { qCCritical(animation) << "AnimNodeLoader, bad array \"characteristicSpeeds\" in blendLinearMove node, id =" << id; return nullptr; } auto speedsArray = speedsValue.toArray(); for (const auto& speedValue : speedsArray) { if (!speedValue.isDouble()) { qCCritical(animation) << "AnimNodeLoader, bad number in \"characteristicSpeeds\", id =" << id; return nullptr; } float speedVal = (float)speedValue.toDouble(); characteristicSpeeds.push_back(speedVal); }; READ_OPTIONAL_STRING(alphaVar, jsonObj); READ_OPTIONAL_STRING(desiredSpeedVar, jsonObj); auto node = std::make_shared<AnimBlendLinearMove>(id, alpha, desiredSpeed, characteristicSpeeds); if (!alphaVar.isEmpty()) { node->setAlphaVar(alphaVar); } if (!desiredSpeedVar.isEmpty()) { node->setDesiredSpeedVar(desiredSpeedVar); } return node; }
static AnimNode::Pointer loadManipulatorNode(const QJsonObject& jsonObj, const QString& id, const QUrl& jsonUrl) { READ_FLOAT(alpha, jsonObj, id, jsonUrl, nullptr); auto node = std::make_shared<AnimManipulator>(id, alpha); READ_OPTIONAL_STRING(alphaVar, jsonObj); if (!alphaVar.isEmpty()) { node->setAlphaVar(alphaVar); } auto jointsValue = jsonObj.value("joints"); if (!jointsValue.isArray()) { qCCritical(animation) << "AnimNodeLoader, bad array \"joints\" in controller node, id =" << id; return nullptr; } auto jointsArray = jointsValue.toArray(); for (const auto& jointValue : jointsArray) { if (!jointValue.isObject()) { qCCritical(animation) << "AnimNodeLoader, bad state object in \"joints\", id =" << id; return nullptr; } auto jointObj = jointValue.toObject(); READ_STRING(jointName, jointObj, id, jsonUrl, nullptr); READ_STRING(rotationType, jointObj, id, jsonUrl, nullptr); READ_STRING(translationType, jointObj, id, jsonUrl, nullptr); READ_STRING(rotationVar, jointObj, id, jsonUrl, nullptr); READ_STRING(translationVar, jointObj, id, jsonUrl, nullptr); AnimManipulator::JointVar::Type jointVarRotationType = stringToAnimManipulatorJointVarType(rotationType); if (jointVarRotationType == AnimManipulator::JointVar::Type::NumTypes) { qCWarning(animation) << "AnimNodeLoader, bad rotationType in \"joints\", id =" << id; jointVarRotationType = AnimManipulator::JointVar::Type::Default; } AnimManipulator::JointVar::Type jointVarTranslationType = stringToAnimManipulatorJointVarType(translationType); if (jointVarTranslationType == AnimManipulator::JointVar::Type::NumTypes) { qCWarning(animation) << "AnimNodeLoader, bad translationType in \"joints\", id =" << id; jointVarTranslationType = AnimManipulator::JointVar::Type::Default; } AnimManipulator::JointVar jointVar(jointName, jointVarRotationType, jointVarTranslationType, rotationVar, translationVar); node->addJointVar(jointVar); }; return node; }
bool CNewbieTable::SetTableData(void* pvTable, WCHAR* pwszSheetName, std::wstring* pstrDataName, BSTR bstrData) { if (0 == wcscmp(pwszSheetName, L"Table_Data_KOR")) { sNEWBIE_TBLDAT* pNewbie = (sNEWBIE_TBLDAT*)pvTable; if (0 == wcscmp(pstrDataName->c_str(), L"Tblidx")) { pNewbie->tblidx = READ_DWORD( bstrData ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Race")) { pNewbie->byRace = READ_BYTE( bstrData, pstrDataName->c_str() ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Class")) { pNewbie->byClass = READ_BYTE( bstrData, pstrDataName->c_str() ); } else if (0 == wcscmp(pstrDataName->c_str(), L"World_Id")) { pNewbie->world_Id = READ_DWORD( bstrData ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Tutorial_World_Tblidx")) { pNewbie->tutorialWorld = READ_DWORD( bstrData ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Spawn_Loc_X")) { pNewbie->vSpawn_Loc.x = READ_FLOAT( bstrData, pstrDataName->c_str() ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Spawn_Loc_Y")) { pNewbie->vSpawn_Loc.y = READ_FLOAT( bstrData, pstrDataName->c_str() ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Spawn_Loc_Z")) { pNewbie->vSpawn_Loc.z = READ_FLOAT( bstrData, pstrDataName->c_str() ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Spawn_Dir_X")) { pNewbie->vSpawn_Dir.x = READ_FLOAT( bstrData, pstrDataName->c_str(), 0.0f ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Spawn_Dir_Z")) { pNewbie->vSpawn_Dir.z = READ_FLOAT( bstrData, pstrDataName->c_str(), 0.0f ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Bind_Loc_X")) { pNewbie->vBind_Loc.x = READ_FLOAT( bstrData, pstrDataName->c_str() ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Bind_Loc_Y")) { pNewbie->vBind_Loc.y = READ_FLOAT( bstrData, pstrDataName->c_str() ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Bind_Loc_Z")) { pNewbie->vBind_Loc.z = READ_FLOAT( bstrData, pstrDataName->c_str() ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Bind_Dir_X")) { pNewbie->vBind_Dir.x = READ_FLOAT( bstrData, pstrDataName->c_str(), 0.0f ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Bind_Dir_Z")) { pNewbie->vBind_Dir.z = READ_FLOAT( bstrData, pstrDataName->c_str(), 0.0f ); } else if ( 0 == wcsncmp(pstrDataName->c_str(), L"Item_Tblidx_", wcslen(L"Item_Tblidx_") ) ) { bool bFound = false; WCHAR szBuffer[1024] = { 0x00, }; for( int i = 0; i < NTL_MAX_NEWBIE_ITEM; i++ ) { swprintf( szBuffer, 1024, L"Item_Tblidx_%d", i + 1 ); if( 0 == wcscmp(pstrDataName->c_str(), szBuffer) ) { pNewbie->aitem_Tblidx[ i ] = READ_DWORD( bstrData ); bFound = true; break; } } if( false == bFound ) { CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else if ( 0 == wcsncmp(pstrDataName->c_str(), L"Position_", wcslen(L"Position_") ) ) { bool bFound = false; WCHAR szBuffer[1024] = { 0x00, }; for( int i = 0; i < NTL_MAX_NEWBIE_ITEM; i++ ) { swprintf( szBuffer, 1024, L"Position_%d", i + 1 ); if( 0 == wcscmp(pstrDataName->c_str(), szBuffer) ) { pNewbie->abyPos[ i ] = READ_BYTE( bstrData, pstrDataName->c_str(), EQUIP_SLOT_TYPE_UNKNOWN ); bFound = true; break; } } if( false == bFound ) { CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else if ( 0 == wcsncmp(pstrDataName->c_str(), L"Stack_Quantity_", wcslen(L"Stack_Quantity_") ) ) { bool bFound = false; WCHAR szBuffer[1024] = { 0x00, }; for( int i = 0; i < NTL_MAX_NEWBIE_ITEM; i++ ) { swprintf( szBuffer, 1024, L"Stack_Quantity_%d", i + 1 ); if( 0 == wcscmp(pstrDataName->c_str(), szBuffer) ) { pNewbie->abyStack_Quantity[ i ] = READ_BYTE( bstrData, pstrDataName->c_str(), 1 ); bFound = true; break; } } if( false == bFound ) { CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else if ( 0 == wcsncmp(pstrDataName->c_str(), L"Skill_Tblidx_", wcslen(L"Skill_Tblidx_") ) ) { bool bFound = false; WCHAR szBuffer[1024] = { 0x00, }; for( int i = 0; i < NTL_MAX_NEWBIE_SKILL; i++ ) { swprintf( szBuffer, 1024, L"Skill_Tblidx_%d", i + 1 ); if( 0 == wcscmp(pstrDataName->c_str(), szBuffer) ) { pNewbie->aSkillTblidx[ i ] = READ_DWORD( bstrData ); bFound = true; break; } } if( false == bFound ) { CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else if ( 0 == wcsncmp(pstrDataName->c_str(), L"Quick_Tblidx", wcslen(L"Quick_Tblidx") ) ) { bool bFound = false; WCHAR szBuffer[1024] = { 0x00, }; for( int i = 0; i < NTL_MAX_NEWBIE_QUICKSLOT_COUNT; i++ ) { swprintf( szBuffer, 1024, L"Quick_Tblidx%d", i + 1 ); if( 0 == wcscmp(pstrDataName->c_str(), szBuffer) ) { pNewbie->asQuickData[ i ].tbilidx = READ_DWORD( bstrData ); bFound = true; break; } } if( false == bFound ) { CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else if ( 0 == wcsncmp(pstrDataName->c_str(), L"Quick_Type", wcslen(L"Quick_Type") ) ) { bool bFound = false; WCHAR szBuffer[1024] = { 0x00, }; for( int i = 0; i < NTL_MAX_NEWBIE_QUICKSLOT_COUNT; i++ ) { swprintf( szBuffer, 1024, L"Quick_Type%d", i + 1 ); if( 0 == wcscmp(pstrDataName->c_str(), szBuffer) ) { pNewbie->asQuickData[ i ].byType = READ_BYTE( bstrData, pstrDataName->c_str() ); bFound = true; break; } } if( false == bFound ) { CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else if ( 0 == wcsncmp(pstrDataName->c_str(), L"Quick_Position", wcslen(L"Quick_Position") ) ) { bool bFound = false; WCHAR szBuffer[1024] = { 0x00, }; for( int i = 0; i < NTL_MAX_NEWBIE_QUICKSLOT_COUNT; i++ ) { swprintf( szBuffer, 1024, L"Quick_Position%d", i + 1 ); if( 0 == wcscmp(pstrDataName->c_str(), szBuffer) ) { pNewbie->asQuickData[ i ].byQuickSlot = READ_BYTE( bstrData, pstrDataName->c_str() ); bFound = true; break; } } if( false == bFound ) { CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else if (0 == wcscmp(pstrDataName->c_str(), L"Map_Name_Tblidx")) { pNewbie->mapNameTblidx = READ_DWORD( bstrData ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Default_Portal_Tblidx")) { pNewbie->defaultPortalTblidx = READ_BYTE( bstrData , pstrDataName->c_str() ); } else if (0 == wcscmp(pstrDataName->c_str(), L"QItem_Tblidx_1")) { pNewbie->qItemTblidx1 = READ_DWORD( bstrData ); } else if (0 == wcscmp(pstrDataName->c_str(), L"QPosition_1")) { pNewbie->byQPosition1 = READ_BYTE( bstrData, pstrDataName->c_str() ); } else if (0 == wcscmp(pstrDataName->c_str(), L"QStack_Quantity_1")) { pNewbie->byQStackQuantity1 = READ_BYTE( bstrData , pstrDataName->c_str() ); } else { CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else { return false; } return true; }
//==================================== ///Reads in the values of the parameters from the plays's parameter text file. void PenaltyShotUs::loadValues() { ///Open the paramater file: ifstream mainFile; mainFile.open("Params/Play_Params/formationPlays/PenaltyShotUsFormationParams.txt", ios::nocreate); ASSERT(mainFile.fail() == 0, "CAN'T OPEN PARAMETER FILE!"); //Load parameter values. See params.h and params.cpp for good examples. //################ ADD PARAMETERS BELOW ################ READ_FLOAT(BLOCKER_X); READ_FLOAT(BLOCKER_Y); READ_FLOAT(BLOCKER_ROTATION); READ_FLOAT(DEFENDER_X); READ_FLOAT(DEFENDER_Y); READ_FLOAT(DEFENDER_ROTATION); READ_FLOAT(AGGRESSOR_X); READ_FLOAT(AGGRESSOR_Y); READ_FLOAT(AGGRESSOR_ROTATION); READ_FLOAT(CREATOR_X); READ_FLOAT(CREATOR_Y); READ_FLOAT(CREATOR_ROTATION); READ_FLOAT(SPECIAL_OP_X); READ_FLOAT(SPECIAL_OP_Y); READ_FLOAT(SPECIAL_OP_ROTATION); //################ ADD PARAMETERS ABOVE ################ mainFile.close(); }
bool CEachDropTable::SetTableData(void* pvTable, WCHAR* pwszSheetName, std::wstring* pstrDataName, BSTR bstrData) { if (0 == wcscmp(pwszSheetName, L"Table_Data_KOR")) { sEACH_DROP_TBLDAT* pDrop = (sEACH_DROP_TBLDAT*)pvTable; if (0 == wcscmp(pstrDataName->c_str(), L"Tblidx")) { pDrop->tblidx = READ_DWORD(bstrData); } else if ( 0 == wcsncmp(pstrDataName->c_str(), L"Item_Tblidx_", wcslen(L"Item_Tblidx_") ) ) { bool bFound = false; WCHAR szBuffer[1024] = { 0x00, }; for( int i = 0; i < NTL_MAX_EACH_DROP; i++ ) { swprintf( szBuffer, 1024, L"Item_Tblidx_%d", i + 1 ); if( 0 == wcscmp(pstrDataName->c_str(), szBuffer) ) { pDrop->aItem_Tblidx[ i ] = READ_DWORD( bstrData ); bFound = true; break; } } if( false == bFound ) { CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else if ( 0 == wcsncmp(pstrDataName->c_str(), L"Drop_Rate_", wcslen(L"Drop_Rate_") ) ) { bool bFound = false; WCHAR szBuffer[1024] = { 0x00, }; for( int i = 0; i < NTL_MAX_EACH_DROP; i++ ) { swprintf( szBuffer, 1024, L"Drop_Rate_%d", i + 1 ); if( 0 == wcscmp(pstrDataName->c_str(), szBuffer) ) { pDrop->afDrop_Rate[ i ] = READ_FLOAT( bstrData, pstrDataName->c_str(), 0.0f ); bFound = true; break; } } if( false == bFound ) { CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else { CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else { return false; } return true; }
void __MsgFunc_TerrainMod( const char *pszName, int iSize, void *pbuf ) { CTerrainModParams params; BEGIN_READ( pbuf, iSize ); unsigned char type = READ_BYTE(); params.m_vCenter.x = READ_FLOAT(); params.m_vCenter.y = READ_FLOAT(); params.m_vCenter.z = READ_FLOAT(); params.m_flRadius = RemapVal( READ_SHORT(), 0, 65535, MIN_TMOD_RADIUS, MAX_TMOD_RADIUS ); params.m_vecMin.x = READ_FLOAT(); params.m_vecMin.y = READ_FLOAT(); params.m_vecMin.z = READ_FLOAT(); params.m_vecMax.x = READ_FLOAT(); params.m_vecMax.y = READ_FLOAT(); params.m_vecMax.z = READ_FLOAT(); params.m_flStrength = READ_FLOAT(); params.m_Flags = READ_BYTE(); if( type == TMod_Suck && (params.m_Flags & CTerrainModParams::TMOD_SUCKTONORMAL) ) { params.m_vNormal.x = READ_FLOAT(); params.m_vNormal.y = READ_FLOAT(); params.m_vNormal.z = READ_FLOAT(); } // Apply the decal first because the place where we're applying the decal // may not be there if we blow it out first! Vector vPosition(0,0,0); QAngle vAngles(0,0,0); int iModel = 0; C_BaseEntity *ent = cl_entitylist->GetEnt( iModel ); if( ent && type == TMod_Sphere ) { effects->DecalShoot( effects->Draw_DecalIndexFromName( "decals/tscorch" ), iModel, ent->GetModel(), vPosition, vAngles, params.m_vCenter, NULL, 0 ); } engine->ApplyTerrainMod( (TerrainModType)type, params ); }
int ua_receive(buffer_el buffer[], int buffer_size, inC_ts05* scade_ctx, extern_in_ctx_t * extern_ctx){ int widget_event_structure_current_size = 0; int A661_Run_Time_Command_limit = 0; int root_current_size = 0; int n = 0; int next_n = 0; /* type root */ switch (buffer[ n ]){ case A661_BEGIN_BLOCK : root_current_size = READ_ULONG(( buffer + ( 4 + n ) )); next_n = ( n + root_current_size ); /* LayerIdent */ switch (buffer[ ( 1 + n ) ]){ case 1 : /* root */ n = ( 8 + n ); A661_Run_Time_Command_limit = ( ( n + root_current_size ) - 12 ); while(( n < A661_Run_Time_Command_limit )){ /* type A661_Run_Time_Command */ switch (READ_USHORT(( buffer + n ))){ case A661_NOTIFY_WIDGET_EVENT : widget_event_structure_current_size = READ_USHORT(( buffer + ( 2 + n ) )); next_n = ( n + widget_event_structure_current_size ); /* WidgetIdent */ switch (READ_USHORT(( buffer + ( 4 + n ) ))){ case 7504 : /* widget_event_structure */ n = ( 6 + n ); /* type EventStructure */ switch (READ_USHORT(( buffer + ( 2 + n ) ))){ case A661_EVT_SELECTION : /* PushButton_A661_EVT_SELECTION */ /* Notify */ scade_ctx->TEST_SAT_Initialization_Fail = TRUE; break; default : break; } n = next_n; break; case 7503 : /* widget_event_structure */ n = ( 6 + n ); /* type EventStructure */ switch (READ_USHORT(( buffer + ( 2 + n ) ))){ case A661_EVT_SELECTION : /* PushButton_A661_EVT_SELECTION */ /* Notify */ scade_ctx->TEST_SAT_Initialization_Success = TRUE; break; default : break; } n = next_n; break; case 7502 : /* widget_event_structure */ n = ( 6 + n ); /* type EventStructure */ switch (READ_USHORT(( buffer + ( 2 + n ) ))){ case A661_EVT_SELECTION : /* PushButton_A661_EVT_SELECTION */ /* Notify */ scade_ctx->TEST_SAT_Ejection_Signal = TRUE; break; default : break; } n = next_n; break; case 6562 : /* widget_event_structure */ n = ( 6 + n ); /* type EventStructure */ switch (READ_USHORT(( buffer + ( 2 + n ) ))){ case A661_EVT_VALUE_CHANGE : /* Slider_A661_EVT_VALUE_CHANGE */ /* Notify */ scade_ctx->TEST_SAT_Period_Update = TRUE; /* EvtValue */ scade_ctx->TEST_SAT_Period_Value = READ_FLOAT(( buffer + ( 6 + n ) )); break; default : break; } n = next_n; break; case 6552 : /* widget_event_structure */ n = ( 6 + n ); /* type EventStructure */ switch (READ_USHORT(( buffer + ( 2 + n ) ))){ case A661_EVT_VALUE_CHANGE : /* Slider_A661_EVT_VALUE_CHANGE */ /* Notify */ scade_ctx->TEST_SAT_DeclinationAngle_Update = TRUE; /* EvtValue */ scade_ctx->TEST_SAT_DeclinationAngle_Value = READ_FLOAT(( buffer + ( 6 + n ) )); break; default : break; } n = next_n; break; case 6542 : /* widget_event_structure */ n = ( 6 + n ); /* type EventStructure */ switch (READ_USHORT(( buffer + ( 2 + n ) ))){ case A661_EVT_VALUE_CHANGE : /* Slider_A661_EVT_VALUE_CHANGE */ /* Notify */ scade_ctx->TEST_SAT_Longitude_Update = TRUE; /* EvtValue */ scade_ctx->TEST_SAT_Longitude_Value = READ_FLOAT(( buffer + ( 6 + n ) )); break; default : break; } n = next_n; break; case 6532 : /* widget_event_structure */ n = ( 6 + n ); /* type EventStructure */ switch (READ_USHORT(( buffer + ( 2 + n ) ))){ case A661_EVT_VALUE_CHANGE : /* Slider_A661_EVT_VALUE_CHANGE */ /* Notify */ scade_ctx->TEST_SAT_Latitude_Update = TRUE; /* EvtValue */ scade_ctx->TEST_SAT_Latitude_Value = READ_FLOAT(( buffer + ( 6 + n ) )); break; default : break; } n = next_n; break; case 6522 : /* widget_event_structure */ n = ( 6 + n ); /* type EventStructure */ switch (READ_USHORT(( buffer + ( 2 + n ) ))){ case A661_EVT_VALUE_CHANGE : /* Slider_A661_EVT_VALUE_CHANGE */ /* Notify */ scade_ctx->TEST_SAT_Altitude_Update = TRUE; /* EvtValue */ scade_ctx->TEST_SAT_Altitude_Value = READ_FLOAT(( buffer + ( 6 + n ) )); break; default : break; } n = next_n; break; case 6512 : /* widget_event_structure */ n = ( 6 + n ); /* type EventStructure */ switch (READ_USHORT(( buffer + ( 2 + n ) ))){ case A661_EVT_VALUE_CHANGE : /* Slider_A661_EVT_VALUE_CHANGE */ /* Notify */ scade_ctx->TEST_SAT_AirSpeed_Update = TRUE; /* EvtValue */ scade_ctx->TEST_SAT_AirSpeed_Value = READ_FLOAT(( buffer + ( 6 + n ) )); break; default : break; } n = next_n; break; case 5101 : /* widget_event_structure */ n = ( 6 + n ); /* type EventStructure */ switch (READ_USHORT(( buffer + ( 2 + n ) ))){ case A661_EVT_SELECTION : /* PushButton_A661_EVT_SELECTION */ /* Notify */ scade_ctx->envia_foto_btn = TRUE; break; default : break; } n = next_n; break; case 1545 : /* widget_event_structure */ n = ( 6 + n ); /* type EventStructure */ switch (READ_USHORT(( buffer + ( 2 + n ) ))){ case A661_EVT_STATE_CHANGE : /* ToggleButton_A661_EVT_STATE_CHANGE */ /* Notify */ scade_ctx->TEST_Camera_Fail_Status_Changed = TRUE; /* EvtToggleState */ scade_ctx->TEST_Camera_Fail_Status_Value = buffer[ ( 4 + n ) ]; break; default : break; } n = next_n; break; case 1542 : /* widget_event_structure */ n = ( 6 + n ); /* type EventStructure */ switch (READ_USHORT(( buffer + ( 2 + n ) ))){ case A661_EVT_SEL_ENTRY_CHANGE : /* ComboBox_A661_EVT_SEL_ENTRY_CHANGE */ /* Notify */ scade_ctx->TEST_SAT_CameraState_Update = TRUE; /* EvtEntryNumber */ scade_ctx->TEST_SAT_CameraState_Value = READ_USHORT(( buffer + ( 4 + n ) )); break; default : break; } n = next_n; break; case 1532 : /* widget_event_structure */ n = ( 6 + n ); /* type EventStructure */ switch (READ_USHORT(( buffer + ( 2 + n ) ))){ case A661_EVT_SEL_ENTRY_CHANGE : /* ComboBox_A661_EVT_SEL_ENTRY_CHANGE */ /* Notify */ scade_ctx->TEST_SAT_PropellersState_Update = TRUE; /* EvtEntryNumber */ scade_ctx->TEST_SAT_PropellersState_Value = READ_USHORT(( buffer + ( 4 + n ) )); break; default : break; } n = next_n; break; case 1525 : /* widget_event_structure */ n = ( 6 + n ); /* type EventStructure */ switch (READ_USHORT(( buffer + ( 2 + n ) ))){ case A661_EVT_STATE_CHANGE : /* ToggleButton_A661_EVT_STATE_CHANGE */ /* Notify */ scade_ctx->_1_Test_HorizonSensor_Fail_Status_Changed = TRUE; /* EvtToggleState */ scade_ctx->Test_HorizonSensor_Fail_Status_Value = buffer[ ( 4 + n ) ]; break; default : break; } n = next_n; break; case 1522 : /* widget_event_structure */ n = ( 6 + n ); /* type EventStructure */ switch (READ_USHORT(( buffer + ( 2 + n ) ))){ case A661_EVT_SEL_ENTRY_CHANGE : /* ComboBox_A661_EVT_SEL_ENTRY_CHANGE */ /* Notify */ scade_ctx->TEST_SAT_HorizonSensorState_Update = TRUE; /* EvtEntryNumber */ scade_ctx->TEST_SAT_HorizonSensorState_Value = READ_USHORT(( buffer + ( 4 + n ) )); break; default : break; } n = next_n; break; case 1515 : /* widget_event_structure */ n = ( 6 + n ); /* type EventStructure */ switch (READ_USHORT(( buffer + ( 2 + n ) ))){ case A661_EVT_STATE_CHANGE : /* ToggleButton_A661_EVT_STATE_CHANGE */ /* Notify */ scade_ctx->Test_Gyroscope_Fail_Status_Changed = TRUE; /* EvtToggleState */ scade_ctx->Test_Gyroscope_Fail_Status_Value = buffer[ ( 4 + n ) ]; break; default : break; } n = next_n; break; case 1512 : /* widget_event_structure */ n = ( 6 + n ); /* type EventStructure */ switch (READ_USHORT(( buffer + ( 2 + n ) ))){ case A661_EVT_SEL_ENTRY_CHANGE : /* ComboBox_A661_EVT_SEL_ENTRY_CHANGE */ /* Notify */ scade_ctx->TEST_SAT_GyroscopeState_Update = TRUE; /* EvtEntryNumber */ scade_ctx->TEST_SAT_GyroscopeState_Value = READ_USHORT(( buffer + ( 4 + n ) )); break; default : break; } n = next_n; break; case 1502 : /* widget_event_structure */ n = ( 6 + n ); /* type EventStructure */ switch (READ_USHORT(( buffer + ( 2 + n ) ))){ case A661_EVT_SEL_ENTRY_CHANGE : /* ComboBox_A661_EVT_SEL_ENTRY_CHANGE */ /* Notify */ scade_ctx->TEST_SAT_OperationMode_Update = TRUE; /* EvtEntryNumber */ scade_ctx->TEST_SAT_OperationMode_Value = READ_USHORT(( buffer + ( 4 + n ) )); break; default : break; } n = next_n; break; default : break; } break; default : break; } n = next_n; } n = ( 4 + n ); break; default : break; } break; default : break; } return n ; }
bool ObjectTable::SetTableData(void* pvTable, WCHAR* pwszSheetName, std::wstring* pstrDataName, BSTR bstrData) { #define READ_STATE( idx ) \ if ( READ_STRING( bstrData, szTemp, 1024 ) ) \ { \ int nCnt = 0; \ char *pToken, *pNextToken; \ \ pToken = strtok_s( szTemp, ";", &pNextToken ); \ \ while ( NULL != pToken ) \ { \ DWORD dwTemp = (DWORD)_atoi64( pToken ); \ \ if ( dwTemp >= INVALID_BYTE ) \ { \ _ASSERTE( !"BYTE 타입의 데이타 값이 최대값 을 초과했습니다." ); \ } \ else \ { \ pObj->abyState[idx][nCnt] = (BYTE)dwTemp; \ } \ \ nCnt++; \ \ pToken = strtok_s( NULL, ";", &pNextToken ); \ } \ } static char szTemp[1024]; if (0 == wcscmp(pwszSheetName, L"Table_Data_KOR")) { sOBJECT_TBLDAT* pObj = (sOBJECT_TBLDAT*)pvTable; if (0 == wcscmp(pstrDataName->c_str(), L"Tblidx")) { pObj->tblidx = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Name")) { pObj->dwName = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Loc_X")) { pObj->vLoc.x = READ_FLOAT(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Loc_Y")) { pObj->vLoc.y = READ_FLOAT(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Loc_Z")) { pObj->vLoc.z = READ_FLOAT(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Dir_X")) { pObj->vDir.x = READ_FLOAT(bstrData, pstrDataName->c_str(), 0.0f); } else if (0 == wcscmp(pstrDataName->c_str(), L"Dir_Y")) { pObj->vDir.y = READ_FLOAT(bstrData, pstrDataName->c_str(), 0.0f); } else if (0 == wcscmp(pstrDataName->c_str(), L"Dir_Z")) { pObj->vDir.z = READ_FLOAT(bstrData, pstrDataName->c_str(), 0.0f); } else if (0 == wcscmp(pstrDataName->c_str(), L"Func")) { pObj->wFunction = (WORD)READ_BITFLAG(bstrData, 0); } else if (0 == wcscmp(pstrDataName->c_str(), L"Min_X")) { pObj->vMin.x = READ_FLOAT(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Min_Y")) { pObj->vMin.y = READ_FLOAT(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Min_Z")) { pObj->vMin.z = READ_FLOAT(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Max_X")) { pObj->vMax.x = READ_FLOAT(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Max_Y")) { pObj->vMax.y = READ_FLOAT(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Max_Z")) { pObj->vMax.z = READ_FLOAT(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"StateType")) { pObj->byStateType = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"DefMainState")) { pObj->byDefMainState = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"DefSubState")) { pObj->byDefSubState = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcsncmp(pstrDataName->c_str(), L"State", wcslen(L"State"))) { bool bFound = false; WCHAR szBuffer[1024] = { 0x00, }; for (int i = 0; i < DBO_MAX_OBJECT_STATE; i++) { swprintf(szBuffer, 1024, L"State%d", i); if (0 == wcscmp(pstrDataName->c_str(), szBuffer)) { READ_STATE(i); bFound = true; break; } } if (false == bFound) { Table::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else if (0 == wcsncmp(pstrDataName->c_str(), L"Click_Sound", wcslen(L"Click_Sound"))) { bool bFound = false; WCHAR szBuffer[1024] = { 0x00, }; for (int i = 0; i < DBO_MAX_OBJECT_STATE; i++) { swprintf(szBuffer, 1024, L"Click_Sound%d", i); if (0 == wcscmp(pstrDataName->c_str(), szBuffer)) { READ_STRING(bstrData, pObj->achClickSound[i], _countof(pObj->achClickSound[i])); bFound = true; break; } } if (false == bFound) { Table::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else if (0 == wcscmp(pstrDataName->c_str(), L"Boundary_Distance")) { pObj->byBoundaryDistance = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"ModelName")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); READ_STRING(bstrData, pObj->szModelName, _countof(pObj->szModelName)); } else if (0 == wcscmp(pstrDataName->c_str(), L"Note")) { // 기획 전용 필드 } else if (0 == wcscmp(pstrDataName->c_str(), L"Contents_Tblidx")) { pObj->contentsTblidx = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Object_Direction_Index")) { pObj->objectDirectionIndex = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"MinQuestId")) { pObj->minQuestId = READ_WORD(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"MaxQuestId")) { pObj->maxQuestId = READ_WORD(bstrData, pstrDataName->c_str()); } else { Table::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else { return false; } return true; }
bool QuestProbabilityTable::SetTableData(void* pvTable, WCHAR* pwszSheetName, std::wstring* pstrDataName, BSTR bstrData) { if (0 == wcscmp(pwszSheetName, L"Table_Data_KOR")) { sQUEST_PROBABILITY_TBLDAT * pProbabilityTbldat = (sQUEST_PROBABILITY_TBLDAT*)pvTable; if (0 == wcscmp(pstrDataName->c_str(), L"Tblidx")) { pProbabilityTbldat->tblidx = READ_TBLIDX(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Name")) { if (false == READ_STRINGW(bstrData, pProbabilityTbldat->wszName, _countof(pProbabilityTbldat->wszName))) { return false; } } else if (0 == wcscmp(pstrDataName->c_str(), L"Note")) { if (false == READ_STRINGW(bstrData, pProbabilityTbldat->wszNote, _countof(pProbabilityTbldat->wszNote))) { return false; } } else if (0 == wcscmp(pstrDataName->c_str(), L"Probability_Type")) { pProbabilityTbldat->byProbabilityType = READ_BYTE(bstrData, pstrDataName->c_str()); } else { WCHAR szBuffer[1024] = { 0x00, }; // Reward Type for (int i = 0; i < NTL_QUEST_PROBABILITY_MAX_COUNT; i++) { swprintf(szBuffer, 1024, L"Reward_Type%d", i + 1); if (0 == wcscmp(pstrDataName->c_str(), szBuffer)) { pProbabilityTbldat->asProbabilityData[i].byType = READ_BYTE(bstrData, pstrDataName->c_str()); return true; } } // Reward Index for (int i = 0; i < NTL_QUEST_PROBABILITY_MAX_COUNT; i++) { swprintf(szBuffer, 1024, L"Reward_Tblidx%d", i + 1); if (0 == wcscmp(pstrDataName->c_str(), szBuffer)) { pProbabilityTbldat->asProbabilityData[i].tblidx = READ_TBLIDX(bstrData); return true; } } // Reward Index for (int i = 0; i < NTL_QUEST_PROBABILITY_MAX_COUNT; i++) { swprintf(szBuffer, 1024, L"Min_Value%d", i + 1); if (0 == wcscmp(pstrDataName->c_str(), szBuffer)) { pProbabilityTbldat->asProbabilityData[i].dwMinValue = READ_DWORD(bstrData); return true; } } // Reward Index for (int i = 0; i < NTL_QUEST_PROBABILITY_MAX_COUNT; i++) { swprintf(szBuffer, 1024, L"Max_Value%d", i + 1); if (0 == wcscmp(pstrDataName->c_str(), szBuffer)) { pProbabilityTbldat->asProbabilityData[i].dwMaxValue = READ_DWORD(bstrData); return true; } } // Rate for (int i = 0; i < NTL_QUEST_PROBABILITY_MAX_COUNT; i++) { swprintf(szBuffer, 1024, L"Drop_Rate%d", i + 1); if (0 == wcscmp(pstrDataName->c_str(), szBuffer)) { pProbabilityTbldat->asProbabilityData[i].fRate = READ_FLOAT(bstrData, pstrDataName->c_str()); return true; } } Table::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } // end if } // end if else { return false; } return true; }
bool UseItemTable::SetTableData(void* pvTable, WCHAR* pwszSheetName, std::wstring* pstrDataName, BSTR bstrData) { if (0 == wcscmp(pwszSheetName, L"Table_Data_KOR")) { sUSE_ITEM_TBLDAT* pItem = (sUSE_ITEM_TBLDAT*)pvTable; if (0 == wcscmp(pstrDataName->c_str(), L"Tblidx")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pItem->tblidx = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Use_Item_Active_Type")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pItem->byUse_Item_Active_Type = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Buff_Group")) { pItem->byBuff_Group = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Cool_Time_Bit_Flag")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pItem->dwCool_Time_Bit_Flag = HexToDec(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Function_Bit_Flag")) { pItem->wFunction_Bit_Flag = (WORD)READ_BITFLAG(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Appoint_Target")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pItem->byAppoint_Target = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Apply_Target")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pItem->byApply_Target = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Apply_Target_Max")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pItem->byApply_Target_Max = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Apply_Range")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pItem->byApply_Range = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Need_State_Bit_Flag")) { WORD wDummy = 0; pItem->wNeed_State_Bit_Flag = ~wDummy; pItem->wNeed_State_Bit_Flag = (WORD)READ_BITFLAG(bstrData, ~wDummy); } else if (0 == wcscmp(pstrDataName->c_str(), L"System_Effect_1")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pItem->aSystem_Effect[0] = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"System_Effect_Type_1")) { pItem->abySystem_Effect_Type[0] = READ_BYTE(bstrData, pstrDataName->c_str()); // [12/1/2006 zeroera] : 설명 : 테이블 체크로 옮길 것 //if (SYSTEM_EFFECT_APPLY_TYPE_FIRST > pItem->abySystem_Effect_Type[0] || // SYSTEM_EFFECT_APPLY_TYPE_LAST < pItem->abySystem_Effect_Type[0]) //{ // _ASSERT(0); // return false; //} } else if (0 == wcscmp(pstrDataName->c_str(), L"System_Effect_Value_1")) { pItem->afSystem_Effect_Value[0] = READ_FLOAT(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"System_Effect_2")) { pItem->aSystem_Effect[1] = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"System_Effect_Type_2")) { pItem->abySystem_Effect_Type[1] = READ_BYTE(bstrData, pstrDataName->c_str()); // [12/1/2006 zeroera] : 설명 : 테이블 체크로 옮길 것 //if (SYSTEM_EFFECT_APPLY_TYPE_FIRST > pItem->abySystem_Effect_Type[1] || // SYSTEM_EFFECT_APPLY_TYPE_LAST < pItem->abySystem_Effect_Type[1]) //{ // _ASSERT(0); // return false; //} } else if (0 == wcscmp(pstrDataName->c_str(), L"System_Effect_Value_2")) { pItem->afSystem_Effect_Value[1] = READ_FLOAT(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Require_LP")) { pItem->wRequire_LP = READ_WORD(bstrData, pstrDataName->c_str(), 0); } else if (0 == wcscmp(pstrDataName->c_str(), L"Require_EP")) { pItem->wRequire_EP = READ_WORD(bstrData, pstrDataName->c_str(), 0); } else if (0 == wcscmp(pstrDataName->c_str(), L"Require_RP_Ball")) { pItem->byRequire_RP_Ball = READ_BYTE(bstrData, pstrDataName->c_str(), 0); } else if (0 == wcscmp(pstrDataName->c_str(), L"Casting_Time")) { pItem->fCasting_Time = READ_FLOAT(bstrData, pstrDataName->c_str(), 0.0f); pItem->dwCastingTimeInMilliSecs = (DWORD)(pItem->fCasting_Time * 1000.0f); } else if (0 == wcscmp(pstrDataName->c_str(), L"Cool_Time")) { pItem->wCool_Time = READ_WORD(bstrData, pstrDataName->c_str(), 0); pItem->dwCoolTimeInMilliSecs = pItem->wCool_Time * 1000; } else if (0 == wcscmp(pstrDataName->c_str(), L"Keep_Time")) { pItem->wKeep_Time = READ_WORD(bstrData, pstrDataName->c_str(), 0); pItem->dwKeepTimeInMilliSecs = pItem->wKeep_Time * 1000; } else if (0 == wcscmp(pstrDataName->c_str(), L"Keep_Effect")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pItem->bKeep_Effect = READ_BOOL(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Use_Range_Min")) { pItem->byUse_Range_Min = READ_BYTE(bstrData, pstrDataName->c_str(), 0); pItem->fUse_Range_Min = (float)(pItem->byUse_Range_Min); } else if (0 == wcscmp(pstrDataName->c_str(), L"Use_Range_Max")) { pItem->byUse_Range_Max = READ_BYTE(bstrData, pstrDataName->c_str(), 0); pItem->fUse_Range_Max = (float)(pItem->byUse_Range_Max); } else if (0 == wcscmp(pstrDataName->c_str(), L"Use_Info_Text")) { pItem->Use_Info_Text = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Casting_Effect")) { READ_STRING(bstrData, pItem->szCasting_Effect, _countof(pItem->szCasting_Effect)); } else if (0 == wcscmp(pstrDataName->c_str(), L"Action_Effect")) { READ_STRING(bstrData, pItem->szAction_Effect, _countof(pItem->szAction_Effect)); } else if (0 == wcscmp(pstrDataName->c_str(), L"Casting_Animation_Start")) { pItem->wCasting_Animation_Start = READ_WORD(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Casting_Animation_Loop")) { pItem->wCasting_Animation_Loop = READ_WORD(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Action_Animation_Index")) { pItem->wAction_Animation_Index = READ_WORD(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Action_Loop_Animation_Index")) { pItem->wAction_Loop_Animation_Index = READ_WORD(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Action_End_Animation_Index")) { pItem->wAction_End_Animation_Index = READ_WORD(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Casting_Effect_Position")) { pItem->byCastingEffectPosition = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Action_Effect_Position")) { pItem->byActionEffectPosition = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"UseLoc_X")) { pItem->fUseLoc_X = READ_FLOAT(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"UseLoc_Z")) { pItem->fUseLoc_Z = READ_FLOAT(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"UseLoc_Radius")) { pItem->fUseLoc_Radius = READ_FLOAT(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"RequiredQuestID")) { pItem->RequiredQuestID = (QUESTID)(READ_WORD(bstrData, pstrDataName->c_str())); } else { Table::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else { return false; } return true; }
bool DragonBallTable::SetTableData(void* pvTable, WCHAR* pwszSheetName, std::wstring* pstrDataName, BSTR bstrData) { if (0 == wcscmp(pwszSheetName, L"Table_Data_KOR")) { sDRAGONBALL_TBLDAT* pDragonBall = (sDRAGONBALL_TBLDAT*)pvTable; if (0 == wcscmp(pstrDataName->c_str(), L"Tblidx")) { pDragonBall->tblidx = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Altar_Group")) { pDragonBall->dwAltarGroup = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Ball_Type")) { pDragonBall->byBallType = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Ball_1_Tblidx")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pDragonBall->aBallTblidx[0] = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Ball_2_Tblidx")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pDragonBall->aBallTblidx[1] = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Ball_3_Tblidx")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pDragonBall->aBallTblidx[2] = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Ball_4_Tblidx")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pDragonBall->aBallTblidx[3] = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Ball_5_Tblidx")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pDragonBall->aBallTblidx[4] = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Ball_6_Tblidx")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pDragonBall->aBallTblidx[5] = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Ball_7_Tblidx")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pDragonBall->aBallTblidx[6] = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Ball_Drop_Tblidx")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pDragonBall->ballDropTblidx = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Ball_Junk_Tblidx")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pDragonBall->ballJunkTblidx = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Start_Dialog")) { pDragonBall->startDialog = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"End_Dialog")) { pDragonBall->endDialog = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Hurry_Dialog")) { pDragonBall->hurryDialog = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Timeover_Dialog")) { pDragonBall->timeoverDialog = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"No_Repeat_Dialog")) { pDragonBall->noRepeatDialog = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Dragon_NPC_Tblidx")) { pDragonBall->dragonNPCTblidx = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Default_Summon_Chat")) { pDragonBall->defaultSummonChat = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Inventory_Full_Dialog")) { pDragonBall->inventoryFullDialog = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Appear_Dir_X")) { pDragonBall->fDir.x = READ_FLOAT(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Appear_Dir_Z")) { pDragonBall->fDir.z = READ_FLOAT(bstrData, pstrDataName->c_str()); } else { Table::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else { return false; } return true; }
bool processStateMachineNode(AnimNode::Pointer node, const QJsonObject& jsonObj, const QString& nodeId, const QUrl& jsonUrl) { auto smNode = std::static_pointer_cast<AnimStateMachine>(node); assert(smNode); READ_STRING(currentState, jsonObj, nodeId, jsonUrl, false); auto statesValue = jsonObj.value("states"); if (!statesValue.isArray()) { qCCritical(animation) << "AnimNodeLoader, bad array \"states\" in stateMachine node, id =" << nodeId; return false; } // build a map for all children by name. std::map<QString, int> childMap; buildChildMap(childMap, node); // first pass parse all the states and build up the state and transition map. using StringPair = std::pair<QString, QString>; using TransitionMap = std::multimap<AnimStateMachine::State::Pointer, StringPair>; TransitionMap transitionMap; using StateMap = std::map<QString, AnimStateMachine::State::Pointer>; StateMap stateMap; auto statesArray = statesValue.toArray(); for (const auto& stateValue : statesArray) { if (!stateValue.isObject()) { qCCritical(animation) << "AnimNodeLoader, bad state object in \"states\", id =" << nodeId; return false; } auto stateObj = stateValue.toObject(); READ_STRING(id, stateObj, nodeId, jsonUrl, false); READ_FLOAT(interpTarget, stateObj, nodeId, jsonUrl, false); READ_FLOAT(interpDuration, stateObj, nodeId, jsonUrl, false); READ_OPTIONAL_STRING(interpType, stateObj); READ_OPTIONAL_STRING(interpTargetVar, stateObj); READ_OPTIONAL_STRING(interpDurationVar, stateObj); READ_OPTIONAL_STRING(interpTypeVar, stateObj); auto iter = childMap.find(id); if (iter == childMap.end()) { qCCritical(animation) << "AnimNodeLoader, could not find stateMachine child (state) with nodeId =" << nodeId << "stateId =" << id; return false; } AnimStateMachine::InterpType interpTypeEnum = AnimStateMachine::InterpType::SnapshotPrev; // default value if (!interpType.isEmpty()) { interpTypeEnum = stringToInterpType(interpType); if (interpTypeEnum == AnimStateMachine::InterpType::NumTypes) { qCCritical(animation) << "AnimNodeLoader, bad interpType on stateMachine state, nodeId = " << nodeId << "stateId =" << id; return false; } } auto statePtr = std::make_shared<AnimStateMachine::State>(id, iter->second, interpTarget, interpDuration, interpTypeEnum); assert(statePtr); if (!interpTargetVar.isEmpty()) { statePtr->setInterpTargetVar(interpTargetVar); } if (!interpDurationVar.isEmpty()) { statePtr->setInterpDurationVar(interpDurationVar); } if (!interpTypeVar.isEmpty()) { statePtr->setInterpTypeVar(interpTypeVar); } smNode->addState(statePtr); stateMap.insert(StateMap::value_type(statePtr->getID(), statePtr)); auto transitionsValue = stateObj.value("transitions"); if (!transitionsValue.isArray()) { qCritical(animation) << "AnimNodeLoader, bad array \"transitions\" in stateMachine node, stateId =" << id << "nodeId =" << nodeId; return false; } auto transitionsArray = transitionsValue.toArray(); for (const auto& transitionValue : transitionsArray) { if (!transitionValue.isObject()) { qCritical(animation) << "AnimNodeLoader, bad transition object in \"transtions\", stateId =" << id << "nodeId =" << nodeId; return false; } auto transitionObj = transitionValue.toObject(); READ_STRING(var, transitionObj, nodeId, jsonUrl, false); READ_STRING(state, transitionObj, nodeId, jsonUrl, false); transitionMap.insert(TransitionMap::value_type(statePtr, StringPair(var, state))); } } // second pass: now iterate thru all transitions and add them to the appropriate states. for (auto& transition : transitionMap) { AnimStateMachine::State::Pointer srcState = transition.first; auto iter = stateMap.find(transition.second.second); if (iter != stateMap.end()) { srcState->addTransition(AnimStateMachine::State::Transition(transition.second.first, iter->second)); } else { qCCritical(animation) << "AnimNodeLoader, bad state machine transtion from srcState =" << srcState->_id << "dstState =" << transition.second.second << "nodeId =" << nodeId; return false; } } auto iter = stateMap.find(currentState); if (iter == stateMap.end()) { qCCritical(animation) << "AnimNodeLoader, bad currentState =" << currentState << "could not find child node" << "id =" << nodeId; } smNode->setCurrentState(iter->second); return true; }
bool CItemOptionTable::SetTableData(void* pvTable, WCHAR* pwszSheetName, std::wstring* pstrDataName, BSTR bstrData) { if (0 == wcscmp(pwszSheetName, L"Table_Data_KOR")) { sITEM_OPTION_TBLDAT* pItem = (sITEM_OPTION_TBLDAT*)pvTable; if (0 == wcscmp(pstrDataName->c_str(), L"Tblidx")) { CheckNegativeInvalid( pstrDataName->c_str(), bstrData ); pItem->tblidx = READ_DWORD( bstrData ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Option_Name")) { CheckNegativeInvalid( pstrDataName->c_str(), bstrData ); READ_STRINGW(bstrData, pItem->wszOption_Name, _countof(pItem->wszOption_Name)); } else if ( 0 == wcscmp(pstrDataName->c_str(), L"Validity_Able") ) { CheckNegativeInvalid( pstrDataName->c_str(), bstrData ); pItem->bValidity_Able = READ_BOOL( bstrData, pstrDataName->c_str() ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Option_Rank")) { CheckNegativeInvalid( pstrDataName->c_str(), bstrData ); pItem->byOption_Rank = READ_BYTE( bstrData, pstrDataName->c_str() ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Item_Group")) { pItem->byItem_Group = READ_BYTE( bstrData, pstrDataName->c_str() ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Max_Quality")) { pItem->byMaxQuality = READ_BYTE( bstrData, pstrDataName->c_str() ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Quality")) { pItem->byQuality = READ_BYTE( bstrData, pstrDataName->c_str() ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Quality_Index")) { pItem->byQualityIndex = READ_BYTE( bstrData, pstrDataName->c_str() ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Cost")) { pItem->dwCost = READ_DWORD( bstrData, 0 ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Level")) { pItem->byLevel = READ_BYTE( bstrData, pstrDataName->c_str() ); } else if ( 0 == wcsncmp(pstrDataName->c_str(), L"System_Effect_", wcslen(L"System_Effect_") ) ) { bool bFound = false; WCHAR szBuffer[1024] = { 0x00, }; for( int i = 0; i < NTL_MAX_SYSTEM_EFFECT_COUNT; i++ ) { swprintf( szBuffer, 1024, L"System_Effect_%d", i + 1 ); if( 0 == wcscmp(pstrDataName->c_str(), szBuffer) ) { pItem->system_Effect[ i ] = READ_DWORD( bstrData ); bFound = true; break; } } if( false == bFound ) { CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else if ( 0 == wcsncmp(pstrDataName->c_str(), L"Type_", wcslen(L"Type_") ) ) { bool bFound = false; WCHAR szBuffer[1024] = { 0x00, }; for( int i = 0; i < NTL_MAX_SYSTEM_EFFECT_COUNT; i++ ) { swprintf( szBuffer, 1024, L"Type_%d", i + 1 ); if( 0 == wcscmp(pstrDataName->c_str(), szBuffer) ) { pItem->bAppliedInPercent[ i ] = READ_BOOL( bstrData, pstrDataName->c_str() ); bFound = true; break; } } if( false == bFound ) { CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else if ( 0 == wcsncmp(pstrDataName->c_str(), L"Value_", wcslen(L"Value_") ) ) { bool bFound = false; WCHAR szBuffer[1024] = { 0x00, }; for( int i = 0; i < NTL_MAX_SYSTEM_EFFECT_COUNT; i++ ) { swprintf( szBuffer, 1024, L"Value_%d", i + 1 ); if( 0 == wcscmp(pstrDataName->c_str(), szBuffer) ) { pItem->nValue[ i ] = READ_DWORD( bstrData ); bFound = true; break; } } if( false == bFound ) { CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else if (0 == wcscmp(pstrDataName->c_str(), L"Active_Effect")) { pItem->activeEffect = READ_DWORD( bstrData ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Active_Rate")) { pItem->fActiveRate = READ_FLOAT( bstrData, pstrDataName->c_str() ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Note")) { READ_STRING(bstrData, pItem->szNote, _countof(pItem->szNote)); } else if (0 == wcscmp(pstrDataName->c_str(), L"Scouter_Info")) { pItem->byScouterInfo = READ_BYTE( bstrData, pstrDataName->c_str() ); } else { CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else { return false; } return true; }
//=============================================================================== void JamAndShootSkill::loadValues() { ///Open the paramater file: ///REMEMBER TO CHANGE THE PARAMETER TEXT FILE NAME TO THE APPROPRIATE NAME! ifstream mainFile; mainFile.open("Params/Skill_Params/JamAndShootSkillParams.txt", ios::nocreate); ASSERT(mainFile.fail() == 0, "CAN'T OPEN PARAMETER FILE!"); //Load parameter values. See params.h and params.cpp for good examples. //################ ADD PARAMETERS BELOW ################ READ_FLOAT(WAIT_TIME); READ_FLOAT(DRIFT_ANGLE); READ_FLOAT(AIM_ANGLE); READ_FLOAT(RANDOM_ANGLE); READ_FLOAT(EDGE_ANGLE); READ_FLOAT(AIM_DISTANCE); READ_FLOAT(FINISHED_TIME); READ_FLOAT(VALID_ANGLE); READ_FLOAT(BOUNCE_ANGLE); READ_FLOAT(ENTERBOX_CAUTION_DIST); READ_FLOAT(SIDE_DIST); READ_FLOAT(SIDE_LANE_FACTOR); READ_FLOAT(DRIFT_ADJUST_ANGLE); READ_INT(PAUSE_FRAMES); READ_INT(PAUSE_RANDOM); //################ ADD PARAMETERS ABOVE ################ mainFile.close(); }
/* NB: Buffer must be writable and nul-terminated, its initial part is * overwritten */ static gboolean sdfile_read_header_text(gchar **buffer, gsize *len, SDFile *sdfile, GError **error) { gchar *val, *p; /* We do not need exact lenght of the minimum file */ if (*len < SDF_MIN_TEXT_SIZE) { err_TOO_SHORT(error); return FALSE; } gwy_clear(sdfile, 1); p = *buffer; val = g_strstrip(gwy_str_next_line(&p)); strncpy(sdfile->version, val, sizeof(sdfile->version)); READ_STRING(p, "ManufacID", val, sdfile->manufacturer, error) READ_STRING(p, "CreateDate", val, sdfile->creation, error) READ_STRING(p, "ModDate", val, sdfile->modification, error) READ_INT(p, "NumPoints", val, sdfile->xres, TRUE, error) READ_INT(p, "NumProfiles", val, sdfile->yres, TRUE, error) READ_FLOAT(p, "Xscale", val, sdfile->xscale, TRUE, error) READ_FLOAT(p, "Yscale", val, sdfile->yscale, TRUE, error) READ_FLOAT(p, "Zscale", val, sdfile->zscale, TRUE, error) READ_FLOAT(p, "Zresolution", val, sdfile->zres, FALSE, error) READ_INT(p, "Compression", val, sdfile->compression, FALSE, error) READ_INT(p, "DataType", val, sdfile->data_type, FALSE, error) READ_INT(p, "CheckType", val, sdfile->check_type, FALSE, error) /* at least */ if (sdfile->data_type < SDF_NTYPES) sdfile->expected_size = 2*sdfile->xres * sdfile->yres; else sdfile->expected_size = -1; /* Skip possible extra header lines */ do { val = gwy_str_next_line(&p); if (!val) break; val = g_strstrip(val); if (g_ascii_isalpha(val[0])) { gwy_debug("Extra header line: <%s>\n", val); } } while (val[0] == ';' || g_ascii_isalpha(val[0])); if (!val || *val != '*') { g_set_error(error, GWY_MODULE_FILE_ERROR, GWY_MODULE_FILE_ERROR_DATA, _("Missing data start marker (*).")); return FALSE; } *buffer = p; *len -= p - *buffer; sdfile->data = (gchar*)*buffer; return TRUE; }