bool XML_ViewParser::HandleAttribute(const char *Tag, const char *Value) { if (StringsEqual(Tag,"map")) { return ReadBooleanValueAsBool(Value,view_settings.MapActive); } else if (StringsEqual(Tag,"fold_effect")) { return ReadBooleanValueAsBool(Value,view_settings.DoFoldEffect); } else if (StringsEqual(Tag,"static_effect")) { return ReadBooleanValueAsBool(Value,view_settings.DoStaticEffect); } else if (StringsEqual(Tag,"interlevel_in_effects")) { return ReadBooleanValueAsBool(Value, view_settings.DoInterlevelTeleportInEffects); } else if (StringsEqual(Tag, "interlevel_out_effects")) { return ReadBooleanValueAsBool(Value, view_settings.DoInterlevelTeleportOutEffects); } UnrecognizedTag(); return false; }
bool XML_FogParser::HandleAttribute(const char *Tag, const char *Value) { if (StringsEqual(Tag,"on")) { if (ReadBooleanValueAsBool(Value,FogPresent)) { IsPresent[0] = true; return true; } else{ return false; } } else if (StringsEqual(Tag,"depth")) { if (ReadFloatValue(Value,Depth)) { IsPresent[1] = true; return true; } else{ return false; } } if (StringsEqual(Tag,"landscapes")) { if (ReadBooleanValueAsBool(Value,AffectsLandscapes)) { IsPresent[2] = true; return true; } else{ return false; } } else if (StringsEqual(Tag,"type")) { return ReadBoundedInt16Value(Value,Type,0,OGL_NUMBER_OF_FOG_TYPES-1); } UnrecognizedTag(); return false; }
bool XML_DeadAssignParser::HandleAttribute(const char *Tag, const char *Value) { if (StringsEqual(Tag,"coll")) { if (ReadBoundedInt16Value(Value,Coll,0,NUMBER_OF_COLLECTIONS-1)) { IsPresent[0] = true; return true; } else return false; } else if (StringsEqual(Tag,"type")) { // The permissible values, -1, 0, and 1, are // NONE // _civilian_thing // _monster_thing if (ReadBoundedInt16Value(Value,Type,short(-1),short(1))) { IsPresent[1] = true; return true; } else return false; } UnrecognizedTag(); return false; }
bool XML_LineWidthParser::HandleAttribute(const char *Tag, const char *Value) { if (StringsEqual(Tag,"type")) { // The permissible values, 0, 1, and 2, are line, elevation, and control panel if (ReadBoundedInt16Value(Value,Type,0,NUMBER_OF_LINE_DEFINITIONS-1)) { IsPresent[0] = true; return true; } else return false; } else if (StringsEqual(Tag,"scale")) { if (ReadBoundedInt16Value(Value,Scale,0,OVERHEAD_MAP_MAXIMUM_SCALE-OVERHEAD_MAP_MINIMUM_SCALE)) { IsPresent[1] = true; return true; } else return false; } else if (StringsEqual(Tag,"width")) { if (ReadInt16Value(Value,Width)) { IsPresent[2] = true; return true; } else return false; } UnrecognizedTag(); return false; }
bool XML_FOVParser::HandleAttribute(const char *Tag, const char *Value) { if (StringsEqual(Tag,"normal")) { return (ReadBoundedNumericalValue(Value,"%f",FOV_Normal,float(0),float(180))); } else if (StringsEqual(Tag,"extra")) { return (ReadBoundedNumericalValue(Value,"%f",FOV_ExtraVision,float(0),float(180))); } else if (StringsEqual(Tag,"tunnel")) { return (ReadBoundedNumericalValue(Value,"%f",FOV_TunnelVision,float(0),float(180))); } else if (StringsEqual(Tag,"rate")) { return (ReadBoundedNumericalValue(Value,"%f",FOV_ChangeRate,float(0),float(180))); } else if (StringsEqual(Tag,"fix_h_not_v")) { return ReadBooleanValueAsBool(Value,FOV_FixHorizontalNotVertical); } UnrecognizedTag(); return false; }
bool XML_OvhdMapParser::HandleAttribute(const char *Tag, const char *Value) { if (StringsEqual(Tag,"mode")) { return ReadBoundedInt16Value(Value,OverheadMapMode,0, NUMBER_OF_OVERHEAD_MAP_MODES-1); } else if (StringsEqual(Tag,"title_offset")) { return ReadInt16Value(Value,OvhdMap_ConfigData.map_name_data.offset_down); } UnrecognizedTag(); return false; }
bool XML_ColorParser::HandleAttribute(const char *Tag, const char *Value) { // Color value to be read in float CVal; if (NumColors > 0) { if (StringsEqual(Tag,"index")) { if (ReadBoundedInt16Value(Value,Index,0,NumColors-1)) { IsPresent[3] = true; return true; } else return false; } } if (StringsEqual(Tag,"red")) { if (ReadFloatValue(Value,CVal)) { IsPresent[0] = true; TempColor.red = uint16(PIN(65535*CVal+0.5,0,65535)); return true; } else return false; } else if (StringsEqual(Tag,"green")) { if (ReadFloatValue(Value,CVal)) { IsPresent[1] = true; TempColor.green = uint16(PIN(65535*CVal+0.5,0,65535)); return true; } else return false; } else if (StringsEqual(Tag,"blue")) { float CVal; if (ReadFloatValue(Value,CVal)) { IsPresent[2] = true; TempColor.blue = uint16(PIN(65535*CVal+0.5,0,65535)); return true; } else return false; } UnrecognizedTag(); return false; }
LPPALETTE Palette_Get( LPPALETTE lpHeadPalette, LPTSTR lpPaletteName, int index ) /************************************************************************/ { LPPALETTE lpNextPalette; int nPalette; nPalette = 0; lpNextPalette = lpHeadPalette; while (lpNextPalette) { if (lpPaletteName) { if (StringsEqual(lpNextPalette->szName, lpPaletteName)) return(lpNextPalette); } else { if (index == nPalette) return(lpNextPalette); } ++nPalette; lpNextPalette = lpNextPalette->lpNext; } return(NULL); }
int Palette_GetNum( LPPALETTE lpHeadPalette, LPTSTR lpPaletteName, LPPALETTE lpPalette ) /************************************************************************/ { LPPALETTE lpNextPalette; int nPalette; nPalette = 0; lpNextPalette = lpHeadPalette; while (lpNextPalette) { if (lpPaletteName) { if (StringsEqual(lpNextPalette->szName, lpPaletteName)) return(nPalette); } else if (lpPalette) { if (lpPalette == lpNextPalette) return(nPalette); } ++nPalette; lpNextPalette = lpNextPalette->lpNext; } return(-1); }
void Dialog_OnScroll(HWND hDlg, HWND hControl, UINT uCode, int iPos) /***************************************************************************/ { STRING szClass; GetClassName(hControl, szClass, sizeof(szClass)-1); if (StringsEqual(szClass, TRACKBAR_CLASS)) SliderOnScroll(hControl, uCode, iPos); }
bool XML_CheatsParser::HandleAttribute(const char *Tag, const char *Value) { if (StringsEqual(Tag,"on")) { return ReadBooleanValueAsBool(Value,CheatsActive); } else if (StringsEqual(Tag,"mac_keymod")) { #ifdef mac return ReadUInt16Value(Value,CheatCodeModMask); #else return true; #endif } UnrecognizedTag(); return false; }
bool XML_PluginParser::HandleAttribute(const char* Tag, const char* Value) { if (StringsEqual(Tag, "name")) { Data.name = Value; return true; } else if (StringsEqual(Tag, "version")) { Data.version = Value; return true; } else if (StringsEqual(Tag, "description")) { Data.description = Value; return true; } else if (StringsEqual(Tag, "minimum_version")) { Data.required_version = Value; return true; } else if (StringsEqual(Tag, "hud_lua")) { Data.hud_lua = Value; return true; } else if (StringsEqual(Tag, "solo_lua")) { Data.solo_lua = Value; return true; } else if (StringsEqual(Tag, "theme_dir")) { Data.theme = Value; return true; } UnrecognizedTag(); return false; }
bool XML_PluginMMLParser::HandleAttribute(const char* Tag, const char* Value) { if (StringsEqual(Tag, "file")) { Data.mmls.push_back(Value); return true; } UnrecognizedTag(); return false; }
bool XML_ShaderParser::HandleAttribute(const char *Tag, const char *Value) { if(StringsEqual(Tag,"name")) { _name = Value; return true; } else if(StringsEqual(Tag,"vert")) { _vert.SetNameWithPath(Value); return true; } else if(StringsEqual(Tag,"frag")) { _frag.SetNameWithPath(Value); return true; } else if(StringsEqual(Tag,"passes")) { return ReadInt16Value(Value,_passes); } UnrecognizedTag(); return true; };
const Meta::Field* Meta::Class::FindField(const char* p_Name) const { for(u32 i = 0; i < m_NumFields; ++i) { if(StringsEqual(m_Fields[i].GetName(), p_Name)) { return &m_Fields[i]; } } return nullptr; }
BOOL GetIniPath( LPSTR lpIniFile ) /************************************************************************/ { FNAME szFileName; BOOL bRet; #ifdef _MAC // The macintosh ALWAYS uses the "Root:System:Preferences:" path when // acessing preferences - ALWAYS. // Do not use path information in the INI filename. return TRUE; #else if ( GetProfileString( "Micrografx", PRIVATE_INI, "", szFileName, sizeof(FNAME) ) > 2 ) { FixPath( szFileName ); lstrcat( szFileName, lpIniFile ); if ( bRet = FileExists( szFileName ) ) goto Found; } #ifdef CDBUILD if ( GetWindowsDirectory( szFileName, sizeof(FNAME) ) > 2 ) { FixPath( szFileName ); lstrcat( szFileName, lpIniFile ); if ( bRet = FileExists( szFileName ) ) goto Found; } #endif lstrcpy( szFileName, Control.ProgHome ); lstrcat( szFileName, lpIniFile ); if ( !(bRet = FileExists( szFileName )) ) Message( IDS_INI_NOEXIST, Lowercase(lpIniFile) ); Found: lstrcpy( lpIniFile, szFileName ); #ifndef CDBUILD if ( bRet && !FilePermission( lpIniFile, 2 /*WRITE*/ ) ) Message( IDS_INI_NOWRITE, Lowercase(lpIniFile) ); #endif // Set the network variable if the INI and EXE are not in the same place lstrcpy( szFileName, lpIniFile ); stripfile( szFileName ); FixPath( szFileName ); Control.bNetworkInstall = !StringsEqual( Control.ProgHome, szFileName ); return( bRet ); #endif // #ifdef _MAC }
bool XML_LO_ClearParser::HandleAttribute(const char *Tag, const char *Value) { if (StringsEqual(Tag,"coll")) { if (ReadBoundedInt16Value(Value,Collection,0,NUMBER_OF_COLLECTIONS-1)) { IsPresent = true; return true; } else{ return false; } } UnrecognizedTag(); return false; }
bool XML_SequenceMapParser::HandleAttribute(const char *Tag, const char *Value) { if (StringsEqual(Tag,"seq")) { if (ReadBoundedInt16Value(Value,Data.Sequence,0, MAXIMUM_SHAPES_PER_COLLECTION-1)) { SeqIsPresent = true; return true; } else{ return false; } } else if (StringsEqual(Tag,"model_seq")) { if (ReadBoundedInt16Value(Value,Data.ModelSequence,NONE, MAXIMUM_SHAPES_PER_COLLECTION-1)) { ModelSeqIsPresent = true; return true; } else{ return false; } } UnrecognizedTag(); return false; }
bool XML_StringParser::HandleAttribute(const char *Tag, const char *Value) { if (StringsEqual(Tag,"index")) { if (ReadInt16Value(Value,Index)) { IndexPresent = true; return true; } else{ return false; } } UnrecognizedTag(); return false; }
bool XML_GetBooleanValue(const char *String, bool &Value) { if (StringsEqual(String,"1")) { Value = true; return true; } else if (StringsEqual(String,"t")) { Value = true; return true; } else if (StringsEqual(String,"true")) { Value = true; return true; } else if (StringsEqual(String,"0")) { Value = false; return true; } else if (StringsEqual(String,"f")) { Value = false; return true; } else if (StringsEqual(String,"false")) { Value = false; return true; } return false; }
bool XML_OvhdMapBooleanParser::HandleAttribute(const char *Tag, const char *Value) { if (StringsEqual(Tag,"on")) { if (ReadBooleanValueAsInt16(Value,IsOn)) { IsPresent = true; return true; } else{ return false; } } UnrecognizedTag(); return false; }
bool XML_ItemParser::HandleAttribute(const char *Tag, const char *Value) { if (StringsEqual(Tag,"index")) { if (ReadBoundedInt16Value(Value,Index,0,NUMBER_OF_DEFINED_ITEMS-1)) { IndexPresent = true; return true; } else return false; } else if (StringsEqual(Tag,"singular")) { if (ReadInt16Value(Value,Data.singular_name_id)) { IsPresent[0] = true; return true; } else return false; } else if (StringsEqual(Tag,"plural")) { if (ReadInt16Value(Value,Data.plural_name_id)) { IsPresent[1] = true; return true; } else return false; } else if (StringsEqual(Tag,"maximum")) { if (ReadBoundedInt16Value(Value,Data.maximum_count_per_player,0,SHRT_MAX)) { IsPresent[2] = true; return true; } else return false; } else if (StringsEqual(Tag,"invalid")) { if (ReadInt16Value(Value,Data.invalid_environments)) { IsPresent[3] = true; return true; } else return false; } else if (StringsEqual(Tag,"type")) { if (ReadBoundedInt16Value(Value,Data.item_kind,0,NUMBER_OF_ITEM_TYPES)) { IsPresent[4] = true; return true; } else return false; } UnrecognizedTag(); return false; }
bool XML_StringSetParser::HandleAttribute(const char *Tag, const char *Value) { if (StringsEqual(Tag,"index")) { short ID; if (ReadInt16Value(Value,ID)) { CurrStringSet = FindStringSet(ID); return true; } else{ return false; } } UnrecognizedTag(); return false; }
bool XML_KeyParser::HandleAttribute(const char *Tag, const char *Value) { if (StringsEqual(Tag,"index")) { if (ReadBoundedInt16Value(Value,Index,0,NUMBER_OF_STANDARD_KEY_DEFINITIONS-1)) { IsPresent[0] = true; return true; } else return false; } // Select whether to accept a SDL or a Macintosh key definition #ifdef SDL else if (StringsEqual(Tag,"sdl")) #else else if (StringsEqual(Tag,"mac")) #endif { if (ReadInt16Value(Value,Key)) { IsPresent[1] = true; return true; } else return false; } // Do nothing in case of the opposite sort of key #ifdef SDL else if (StringsEqual(Tag,"mac")) #else else if (StringsEqual(Tag,"sdl")) #endif { // OK no matter what return true; } UnrecognizedTag(); return false; }
void CPPPropertyPage::OnVScroll(UINT uCode, UINT iPos, CScrollBar *pScrollBar) { if (pScrollBar) { STRING szClass; GetClassName(pScrollBar->GetSafeHwnd(), szClass, sizeof(szClass)-1); if (StringsEqual(szClass, TRACKBAR_CLASS)) { SliderOnScroll(pScrollBar->GetSafeHwnd(), uCode, (int)iPos); return; } } CPropertyPage::OnVScroll(uCode, iPos, pScrollBar); }
bool XML_DynLimValueParser::HandleAttribute(const char *Tag, const char *Value) { if (StringsEqual(Tag,"value")) { if (ReadBoundedUInt16Value(Value,*ValuePtr,0,32767)) { IsPresent = true; return true; } else return false; } UnrecognizedTag(); return false; }
bool XML_CheatKeywordParser::HandleAttribute(const char *Tag, const char *Value) { if (StringsEqual(Tag,"index")) { if (ReadBoundedInt16Value(Value,Index,0,int(NUMBER_OF_KEYWORDS-1))) { IsPresent = true; return true; } else return false; } UnrecognizedTag(); return false; }
bool XML_KeyboardParser::HandleAttribute(const char *Tag, const char *Value) { if (StringsEqual(Tag,"set")) { short WhichSet = 0; if (ReadBoundedInt16Value(Value,WhichSet,0,NUMBER_OF_KEY_SETUPS-1)) { XML_KeySet = all_key_definitions[WhichSet]; IsPresent = true; return true; } else return false; } UnrecognizedTag(); return false; }
bool XML_LandscapeParser::HandleAttribute(const char *Tag, const char *Value) { if (StringsEqual(Tag,"coll")) { if (ReadBoundedInt16Value(Value,Collection,short(AnyFrame),short(NUMBER_OF_COLLECTIONS-1))) { IsPresent = true; return true; } else return false; } else if (StringsEqual(Tag,"frame")) { return ReadBoundedInt16Value(Value,Frame,0,MAXIMUM_SHAPES_PER_COLLECTION-1); } else if (StringsEqual(Tag,"horiz_exp")) { return ReadInt16Value(Value,Data.HorizExp); } else if (StringsEqual(Tag,"vert_exp")) { return ReadInt16Value(Value,Data.VertExp); } else if (StringsEqual(Tag,"vert_repeat")) { return ReadBooleanValueAsBool(Value,Data.VertRepeat); } else if (StringsEqual(Tag,"ogl_asprat_exp")) { return ReadInt16Value(Value,Data.OGL_AspRatExp); } else if (StringsEqual(Tag,"azimuth")) { float Azimuth; if (ReadFloatValue(Value,Azimuth)) { Azimuth = Azimuth - 360*int(Azimuth/360); if (Azimuth < 0) Azimuth += 360; Data.Azimuth = angle(FULL_CIRCLE*(Azimuth/360) + 0.5); return true; } return false; } UnrecognizedTag(); return false; }
BOOL StringsEqualN( LPTSTR pszStr1, LPTSTR pszStr2, int len ) /************************************************************************/ { int len1, len2; FNAME psz1, psz2; len1 = lstrlen( pszStr1 ); len2 = lstrlen( pszStr2 ); if( len1 < len || len2 < len ) return( NO ); lstrcpy( psz1, pszStr1 ); TerminateString( psz1, len ); lstrcpy( psz2, pszStr2 ); TerminateString( psz2, len ); return StringsEqual( psz1, psz2 ); }