Resizer::Resizer(HWND hWnd, int t) { SetInitialPosition(hWnd, t); }
bool Player::Parse(TiXmlElement* xml) { assert(xml); if (xml == 0) return false; // file could not be opened const char *str; str = xml->Attribute("cfg"); if (str) { return XMLConfigurable::Parse(str); } SceneObject::Parse(xml); str = xml->Value(); assert(strcmp(str,"player")==0); int x, y, z, resx, resy, resz; resx = xml->QueryIntAttribute("x", &x); //assert(TIXML_SUCCESS==res); resy = xml->QueryIntAttribute("y", &y); //assert(TIXML_SUCCESS==res); resz = xml->QueryIntAttribute("z", &z); //assert(TIXML_SUCCESS==res); //Init(); if (TIXML_SUCCESS==resx && TIXML_SUCCESS==resy && TIXML_SUCCESS==resz) SetInitialPosition(Vector3((float)x,(float)y,(float)z)); TiXmlElement *game_config = CommonDeclarations::GetGameConfig(); assert(game_config); if (game_config) { TiXmlElement *xml_element = NULL, *player_cfg=NULL; player_cfg = game_config->FirstChildElement("player"); assert(player_cfg); xml_element = player_cfg->FirstChildElement("strafe_roll"); assert(xml_element); if (xml_element) { int res; res = xml_element->QueryFloatAttribute("roll_fps",&StrafeFps); assert(TIXML_SUCCESS==res); res = xml_element->QueryFloatAttribute("max_roll_angle",&MaxStrafeRollAngle); assert(TIXML_SUCCESS==res); MaxStrafeRollAngle = Ogre::Math::DegreesToRadians(MaxStrafeRollAngle); res = xml_element->QueryFloatAttribute("roll_speed",&StrafeRollSpeed); assert(TIXML_SUCCESS==res); res = xml_element->QueryFloatAttribute("angle_buffer",&StrafeBufferAngle); assert(TIXML_SUCCESS==res); StrafeBufferAngle = Ogre::Math::DegreesToRadians(StrafeBufferAngle); } xml_element = player_cfg->FirstChildElement("look_roll"); assert(xml_element); if (xml_element) { int res; res = xml_element->QueryFloatAttribute("roll_fps",&LookFps); assert(TIXML_SUCCESS==res); res = xml_element->QueryFloatAttribute("max_roll_angle",&MaxLookRollAngle); assert(TIXML_SUCCESS==res); MaxLookRollAngle = Ogre::Math::DegreesToRadians(MaxLookRollAngle); res = xml_element->QueryFloatAttribute("roll_speed",&LookRollSpeed); assert(TIXML_SUCCESS==res); res = xml_element->QueryFloatAttribute("angle_buffer",&LookBufferAngle); assert(TIXML_SUCCESS==res); LookBufferAngle = Ogre::Math::DegreesToRadians(LookBufferAngle); } } return true; }
void main(int argc,char *argv[]) { HMQ hmqQueue; QMSG qmsgMessage; ULONG flCreate; LONG lIndex; char szString[80]; int iIndex; HFILE hCom; APIRET rc; ULONG ulAction; ULONG cbDataSize = sizeof(ULONG); if (argc >= 2) { for (lIndex = 1;lIndex < argc;lIndex++) { if ((argv[lIndex][0] == '/') || (argv[lIndex][0] == '-')) { switch (argv[lIndex][1] & 0xdf) { case 'X': bDebug = TRUE; break; default: strcpy(szDemoPath,&argv[lIndex][1]); bInstallDemo = TRUE; break; } } } } stInst.hab = WinInitialize((USHORT)NULL); hmqQueue = WinCreateMsgQueue(stInst.hab,0); WinRegisterClass(stInst.hab, "INSTALL", (PFNWP)fnwpClient, 0L, 4); DosQuerySysInfo(QSV_MAX_PATH_LENGTH,QSV_MAX_PATH_LENGTH,&stInst.ulMaxPathLen,sizeof(ULONG)); MemAlloc(&pszPath,((stInst.ulMaxPathLen * 3) + 20)); MemAlloc(&stInst.paszStrings[CONFIGDDLIBRARYSPEC],(stInst.ulMaxPathLen + 1)); MemAlloc(&stInst.pszSourceIniPath,(stInst.ulMaxPathLen + 1)); MemAlloc(&stInst.paszStrings[CURRENTDRIVERSPEC],(stInst.ulMaxPathLen + 1)); MemAlloc(&stInst.paszStrings[DRIVERINISPEC],(stInst.ulMaxPathLen + 1)); MemAlloc(&stInst.paszStrings[XFERLIBRARYSPEC],(stInst.ulMaxPathLen + 1)); MemAlloc(&stInst.pszDLLpath,(stInst.ulMaxPathLen + 1)); MemAlloc(&stInst.pszAppsPath,(stInst.ulMaxPathLen + 1)); MemAlloc(&pszUninstallIniPath,(stInst.ulMaxPathLen + 1)); MemAlloc(&pszCurrentAppsPath,(stInst.ulMaxPathLen + 1)); MemAlloc(&stInst.pszSourcePath,(stInst.ulMaxPathLen + 1)); MemAlloc(&pszHelpFileSpec,(stInst.ulMaxPathLen + 1)); MemAlloc(&stCOMiCFG.pszDriverIniSpec,(stInst.ulMaxPathLen + 1)); MemAlloc(&stInst.paszStrings[CONFIGAPPLIBRARYSPEC],(stInst.ulMaxPathLen + 1)); DosQuerySysInfo(QSV_BOOT_DRIVE,QSV_BOOT_DRIVE,&ulBootDrive,sizeof(ULONG)); stInst.chBootDrive = ('A' + (char)ulBootDrive - 1); if (bDebug) PrintDebug("Debug Messaging","is enabled"); if ((rc = DosOpen(SPECIAL_DEVICE,&hCom,&ulAction,0L,0L,0x0001,0x21c2,0L)) == 0) { if ((GetDriverPath(hCom,pszPath)) && (pszPath[1] == ':')) { for (iIndex = 0;iIndex < stInst.ulMaxPathLen;iIndex++) { if (pszPath[iIndex] == ' ') break; pszPath[iIndex] = toupper(pszPath[iIndex]); } strcpy(szDriverVersionString,&pszPath[iIndex + 1]); szDriverVersionString[strlen(szDriverVersionString) - 3] = 0; pszPath[iIndex] = 0; strcpy(stInst.paszStrings[CURRENTDRIVERSPEC],pszPath); MemAlloc(&stInst.paszStrings[REMOVEOLDDRIVERSPEC],(stInst.ulMaxPathLen + 1)); strcpy(stInst.paszStrings[REMOVEOLDDRIVERSPEC],pszPath); strcpy(stInst.paszStrings[DRIVERINISPEC],pszPath); AppendINI(stInst.paszStrings[DRIVERINISPEC]); SetEndOfPath(pszPath); strcpy(stInst.pszDLLpath,pszPath); strcpy(stInst.pszAppsPath,pszPath); sprintf(pszUninstallIniPath,"%s\\%s",pszPath,szUninstallIniFileName); bCOMiInstalled = TRUE; bItemOneLocked = FALSE; } DosClose(hCom); } strcpy(stInst.pszSourcePath,argv[0]); SetEndOfPath(stInst.pszSourcePath); sprintf(pszHelpFileSpec,"%s\\%s",stInst.pszSourcePath,szHelpFileName); if (bInstallDemo) { if (szDemoPath[strlen(szDemoPath) - 1] =='\\') szDemoPath[iIndex - 1] = 0; strncpy(pszPath,stInst.pszSourcePath,3); iIndex = 3; if (pszPath[2] != '\\') { iIndex = 2; pszPath[2] = '\\'; } sprintf(&pszPath[3],"%s\\%s",szDemoPath,&stInst.pszSourcePath[iIndex]); strcpy(stInst.pszSourcePath,pszPath); } sprintf(stInst.pszSourceIniPath,"%s\\%s",stInst.pszSourcePath,szIniFileName); if (bDebug) PrintDebug("Source Ini File",stInst.pszSourceIniPath); stInst.bCopyCOMscope = TRUE; stInst.bCopyPager = TRUE; stInst.bCopyCOMi = TRUE; stInst.bCreateObjects = TRUE; #ifdef this_junk stInst.bCopyInstall = TRUE; stInst.bCopyUtil = TRUE; stInst.bCopyPDR = TRUE; stInst.bCopyLibraries = TRUE; #endif hSourceProfile = PrfOpenProfile(stInst.hab,stInst.pszSourceIniPath); if (hSourceProfile != 0) { PrfQueryProfileString(hSourceProfile,"Install","False Start 1",0,szFalseStart1,400); PrfQueryProfileString(hSourceProfile,"Install","False Start 2",0,szFalseStart2,400); if (!PrfQueryProfileData(hSourceProfile,"Install","bConfigurationOnly",&bConfigurationOnly,&cbDataSize)) bConfigurationOnly = FALSE; PrfQueryProfileString(hSourceProfile,"COMi","Driver","COMDD.SYS",szDDname,18); PrfQueryProfileString(hSourceProfile,"COMi","Version",0,szCOMiVersion,60); PrfQueryProfileString(hSourceProfile,"COMscope","Version",0,szCOMscopeVersion,60); PrfQueryProfileString(hSourceProfile,"Pager","Pager File","PAGERDEF.PAG",szPagerFileName,20); PrfQueryProfileString(hSourceProfile,"Pager","Version",0,szAppVersion,60); PrfQueryProfileString(hSourceProfile,"Pager","Icon File",0,szAppIconFile,60); PrfQueryProfileString(hSourceProfile,"Install","Banner One","for the",szBannerOne,MAX_BANNER); PrfQueryProfileString(hSourceProfile,"Install","Banner Two","COMi Device Driver",szBannerTwo,MAX_BANNER); PrfQueryProfileString(hSourceProfile,"Install","Title","COMi Device Driver Install",szEXEtitle,60); PrfQueryProfileString(hSourceProfile,"Install","DD Name","COMi",szConfigDDname,20); PrfQueryProfileString(hSourceProfile,"Install","App Name",0,szConfigAppName,20); PrfQueryProfileString(hSourceProfile,"Install","Apps Path","C:\\COMM",szDefaultAppsPath,60); PrfQueryProfileString(hSourceProfile,"Install","Libs Path","C:\\COMM",szDefaultDLLpath,60); PrfQueryProfileString(hSourceProfile,"Install","Version",0,szInstallVersion,60); PrfQueryProfileString(hSourceProfile,"Install","Info File",0,szInfoFileName,20); PrfQueryProfileString(hSourceProfile,"Install","Info Caption",0,szInfoCaption,60); PrfQueryProfileString(hSourceProfile,"Install","License File",0,szLicenseFileName,20); PrfQueryProfileString(hSourceProfile,"Install","License Caption",0,szLicenseCaption,60); PrfQueryProfileString(hSourceProfile,"Install","Check Caption One",0,szCheckOneCaption,60); PrfQueryProfileString(hSourceProfile,"Install","Check Caption Two",0,szCheckTwoCaption,60); PrfQueryProfileString(hSourceProfile,"Install","Check Caption Three",0,szCheckThreeCaption,60); PrfQueryProfileString(hSourceProfile,"Install","Check Caption Four",0,szCheckFourCaption,60); PrfQueryProfileString(hSourceProfile,"Install","Check Caption Five",0,szCheckFiveCaption,60); PrfQueryProfileString(hSourceProfile,"Install","DD Config Help","COMscope.HLP",szConfigDDhelpFileName,60); PrfQueryProfileString(hSourceProfile,"Install","App Config Help",0,szConfigAppHelpFileName,60); PrfQueryProfileString(hSourceProfile,"Install","DD Config Library",COMi_CONFIG_LIB,szConfigDDlibraryName,60); PrfQueryProfileString(hSourceProfile,"Install","DD Config Function","InstallDevice",szConfigDDfunctionName,60); PrfQueryProfileString(hSourceProfile,"Install","Transfer Library",COMi_INSTALL_LIB,szTransferLibraryName,60); sprintf(stInst.paszStrings[XFERLIBRARYSPEC],"%s\\%s.DLL",stInst.pszSourcePath,szTransferLibraryName); PrfQueryProfileString(hSourceProfile,"Install","Transfer Function","TransferFiles",szTransferFunctionName,60); PrfQueryProfileString(hSourceProfile,"Install","App Config Library",0,szConfigAppLibraryName,60); PrfQueryProfileString(hSourceProfile,"Install","App Config Function",0,szConfigAppFunctionName,60); if (!PrfQueryProfileData(hSourceProfile,"COMi","OEM_type",&ulOEMtype,&cbDataSize)) ulOEMtype = 0; if (!PrfQueryProfileData(hSourceProfile,"COMi","Max Device Count",&stCOMiCFG.ulMaxDeviceCount,&cbDataSize)) stCOMiCFG.ulMaxDeviceCount = 0; if (!PrfQueryProfileData(hSourceProfile,"COMscope","ProgramSize",&ulCOMscopeSize,&cbDataSize)) { stInst.bCopyCOMscope = FALSE; bCOMscopeToInstall = FALSE; } if (!PrfQueryProfileData(hSourceProfile,"Pager","ProgramSize",&ulPagerSize,&cbDataSize)) { stInst.bCopyPager = FALSE; bPagerToInstall = FALSE; } if (!PrfQueryProfileData(hSourceProfile,"COMi","ProgramSize",&ulCOMiSize,&cbDataSize)) { stInst.bCopyCOMi = FALSE; bCOMiToInstall = FALSE; } if (!PrfQueryProfileData(hSourceProfile,"Install","ProgramSize",&ulInstallSize,&cbDataSize)) { stInst.bCopyInstall = FALSE; bInstallToInstall = FALSE; } if (!PrfQueryProfileData(hSourceProfile,"Utilities","ProgramSize",&ulUtilSize,&cbDataSize)) { stInst.bCopyUtil = FALSE; bUtilToInstall = FALSE; } if (!PrfQueryProfileData(hSourceProfile,"PDR","ProgramSize",&ulPDRsize,&cbDataSize)) { stInst.bCopyPDR = FALSE; bPDRtoInstall = FALSE; } if (!PrfQueryProfileData(hSourceProfile,"Libraries","ProgramSize",&ulLibsSize,&cbDataSize)) { stInst.bCopyLibraries = FALSE; bLibrariesToInstall = FALSE; } if (!stInst.bCopyCOMscope) stInst.bCopyInstall = TRUE; } else exit(55); if (!bCOMiInstalled) { if (strlen(szFalseStart1) != 0) bFalseStart = TRUE; else { if (PrfQueryProfileString(HINI_USERPROFILE,szConfigDDname,"Initialization",0L, pszPath, stInst.ulMaxPathLen) != 0) { strcpy(stInst.pszAppsPath,pszPath); SetEndOfPath(stInst.pszAppsPath); sprintf(pszUninstallIniPath,"%s\\%s",stInst.pszAppsPath,szUninstallIniFileName); bPreviousInstallation = TRUE; } else { strcpy(stInst.pszAppsPath,szDefaultAppsPath); stInst.pszAppsPath[0] = stInst.chBootDrive; sprintf(pszUninstallIniPath,"%s\\%s",stInst.pszAppsPath,szUninstallIniFileName); strcpy(stInst.pszDLLpath,szDefaultDLLpath); stInst.pszDLLpath[0] = stInst.chBootDrive; sprintf(pszPath,"%s\\%s",stInst.pszAppsPath,szDDname); } // strcpy(stInst.paszStrings[CURRENTDRIVERSPEC],pszPath); strcpy(stInst.paszStrings[DRIVERINISPEC],pszPath); AppendINI(stInst.paszStrings[DRIVERINISPEC]); } } strcpy(stCOMiCFG.pszDriverIniSpec,stInst.paszStrings[DRIVERINISPEC]); if (strlen(pszUninstallIniPath) != 0) { if (DosQueryPathInfo(pszUninstallIniPath,1,&stFileStatus,sizeof(FILESTATUS3)) == NO_ERROR) { if ((hInstalledProfile = PrfOpenProfile(stInst.hab,pszUninstallIniPath)) != 0) { if (PrfQueryProfileString(hInstalledProfile,"Installed","Program Path",0,pszPath,stInst.ulMaxPathLen)) { strcpy(pszCurrentAppsPath,pszPath); bUninstall = TRUE; } if (PrfQueryProfileString(hInstalledProfile,"Installed","Library Path",0,pszPath,stInst.ulMaxPathLen)) strcpy(stInst.pszDLLpath,pszPath); else strcpy(stInst.pszDLLpath,stInst.pszAppsPath); PrfCloseProfile(hInstalledProfile); } } } stInst.cbSize = sizeof(INSTALL); sprintf(stInst.paszStrings[CONFIGDDLIBRARYSPEC],"%s\\%s.DLL",stInst.pszSourcePath,szConfigDDlibraryName); stCOMiCFG.byOEMtype = (BYTE)ulOEMtype; flCreate = (FCF_BORDER | FCF_ACCELTABLE | FCF_TASKLIST | FCF_MENU | FCF_TITLEBAR | FCF_SYSMENU); stInst.hwndFrame = WinCreateStdWindow(HWND_DESKTOP, 0L, &flCreate, "INSTALL", NULL, WS_CLIPCHILDREN, (HMODULE)NULL, WIN_INSTALL, &hwndClient); WinSetWindowText(stInst.hwndFrame,szEXEtitle); SetInitialPosition(stInst.hwndFrame); WinShowWindow(stInst.hwndFrame,TRUE); WinSetFocus(HWND_DESKTOP,hwndClient); if (strlen(szConfigAppName) == 0) { WinSendMsg(WinWindowFromID(stInst.hwndFrame,FID_MENU),MM_REMOVEITEM,MPFROM2SHORT(IDM_CONFIG_APP,TRUE),(MPARAM)0); #ifdef this_junk bItemThreeLocked = TRUE; InsertAppMenu(); MenuItemEnable(stInst.hwndFrame,IDM_CONFIG_APP,FALSE); #endif } if ((hwndInstallHelpInstance = HelpInit(pszHelpFileSpec,szHelpWindowTitle)) == 0) { MenuItemEnable(stInst.hwndFrame,IDM_HELPINDEX,FALSE); MenuItemEnable(stInst.hwndFrame,IDM_HELPEXTEND,FALSE); MenuItemEnable(stInst.hwndFrame,IDM_HELPKEYS,FALSE); MenuItemEnable(stInst.hwndFrame,IDM_HELPFORHELP,FALSE); } while(WinGetMsg(stInst.hab,&qmsgMessage,(HWND)NULL,0,0)) WinDispatchMsg(stInst.hab,&qmsgMessage); DestroyHelpInstance(hwndInstallHelpInstance); if (hConfigProfile != 0) PrfCloseProfile(hConfigProfile); if (hSourceProfile != 0) PrfCloseProfile(hSourceProfile); MemFree(pszPath); MemFree(stInst.paszStrings[XFERLIBRARYSPEC]); MemFree(stInst.paszStrings[CONFIGDDLIBRARYSPEC]); MemFree(stCOMiCFG.pszRemoveOldDriverSpec); MemFree(stInst.pszSourceIniPath); if (stInst.paszStrings[REMOVEOLDDRIVERSPEC] != NULL) MemFree(stInst.paszStrings[REMOVEOLDDRIVERSPEC]); MemFree(stInst.paszStrings[CURRENTDRIVERSPEC]); MemFree(stInst.paszStrings[DRIVERINISPEC]); MemFree(stInst.pszDLLpath); MemFree(stInst.pszAppsPath); MemFree(pszUninstallIniPath); MemFree(pszCurrentAppsPath); MemFree(stInst.pszSourcePath); MemFree(pszHelpFileSpec); MemFree(stCOMiCFG.pszDriverIniSpec); WinDestroyWindow(stInst.hwndFrame); WinDestroyMsgQueue(hmqQueue); WinTerminate(stInst.hab); exit(0); }