afSettings.cpp
资源名称:AirForce.rar [点击查看]
上传用户:kaiguan
上传日期:2007-10-28
资源大小:1074k
文件大小:7k
源码类别:
其他游戏
开发平台:
Visual C++
- #pragma warning(disable: 4514)
- #include "afSettings.h"
- #include <direct.h>
- #include <string.h>
- #include <stdlib.h>
- char* afSettings::pathApp = NULL;
- char* afSettings::pathAni = NULL;
- char* afSettings::pathAudio = NULL;
- char* afSettings::pathBSP = NULL;
- char* afSettings::pathChar = NULL;
- char* afSettings::pathGame = NULL;
- char* afSettings::pathPath = NULL;
- char* afSettings::pathLevel = NULL;
- char* afSettings::pathMD2 = NULL;
- char* afSettings::pathOBJ = NULL;
- char* afSettings::pathPS = NULL;
- char* afSettings::pathTex = NULL;
- char* afSettings::pathTerrain = NULL;
- char* afSettings::pathBspTex = NULL;
- char* createFullPath(const char* nPath1, const char* nPath2)
- {
- char* fullPath = new char[strlen(nPath1)+strlen(nPath2)+2];
- strcpy(fullPath, nPath1);
- strcat(fullPath, "\");
- strcat(fullPath, nPath2);
- return fullPath;
- }
- void afSettings::init()
- {
- pathApp = new char[_MAX_PATH];
- _getcwd(pathApp, _MAX_PATH);
- pathAni = createFullPath(pathApp, "animation");
- pathAudio = createFullPath(pathApp, "audio");
- pathBSP = createFullPath(pathApp, "bsp");
- pathChar = createFullPath(pathApp, "game");
- pathGame = createFullPath(pathApp, "game");
- pathPath = createFullPath(pathApp, "path");
- pathLevel = createFullPath(pathApp, "level");
- pathMD2 = createFullPath(pathApp, "md2");
- pathOBJ = createFullPath(pathApp, "obj");
- pathPS = createFullPath(pathApp, "animation");
- pathTerrain = createFullPath(pathApp, "terrain");
- pathTex = createFullPath(pathApp, "texture");
- pathBspTex = createFullPath(pathApp, "bsp");
- }
- char* afSettings::tmpFullPath(const char* nFileName, const char* nExt)
- {
- static char fullPath[_MAX_PATH];
- strcpy(fullPath, pathApp);
- strcat(fullPath, "\");
- strcat(fullPath, nFileName);
- if(nExt)
- strcat(fullPath, nExt);
- return fullPath;
- }
- void afSettings::extendToAniPath(const char* nFileName, char* nFullName)
- {
- strcpy(nFullName, pathAni);
- strcat(nFullName, "\");
- strcat(nFullName, nFileName);
- }
- char* afSettings::tmpFullAniPath(const char* nFileName, const char* nExt)
- {
- static char fullPath[_MAX_PATH];
- extendToAniPath(nFileName, fullPath);
- if(nExt)
- strcat(fullPath, nExt);
- return fullPath;
- }
- void afSettings::extendToBSPPath(const char* nFileName, char* nFullName)
- {
- strcpy(nFullName, pathBSP);
- strcat(nFullName, "\");
- strcat(nFullName, nFileName);
- }
- char* afSettings::tmpFullBSPPath(const char* nFileName, const char* nExt)
- {
- static char fullPath[_MAX_PATH];
- extendToBSPPath(nFileName, fullPath);
- if(nExt)
- strcat(fullPath, nExt);
- return fullPath;
- }
- void afSettings::extendToCharPath(const char* nFileName, char* nFullName)
- {
- strcpy(nFullName, pathChar);
- strcat(nFullName, "\");
- strcat(nFullName, nFileName);
- }
- char* afSettings::tmpFullCharPath(const char* nFileName, const char* nExt)
- {
- static char fullPath[_MAX_PATH];
- extendToCharPath(nFileName, fullPath);
- if(nExt)
- strcat(fullPath, nExt);
- return fullPath;
- }
- void afSettings::extendToAudioPath(const char* nFileName, char* nFullName)
- {
- strcpy(nFullName, pathAudio);
- strcat(nFullName, "\");
- strcat(nFullName, nFileName);
- }
- char* afSettings::tmpFullAudioPath(const char* nFileName, const char* nExt)
- {
- static char fullPath[_MAX_PATH];
- extendToAudioPath(nFileName, fullPath);
- if(nExt)
- strcat(fullPath, nExt);
- return fullPath;
- }
- void afSettings::extendToGamePath(const char* nFileName, char* nFullName)
- {
- strcpy(nFullName, pathGame);
- strcat(nFullName, "\");
- strcat(nFullName, nFileName);
- }
- char* afSettings::tmpFullGamePath(const char* nFileName, const char* nExt)
- {
- static char fullPath[_MAX_PATH];
- extendToGamePath(nFileName, fullPath);
- if(nExt)
- strcat(fullPath, nExt);
- return fullPath;
- }
- void afSettings::extendToPathPath(const char* nFileName, char* nFullName)
- {
- strcpy(nFullName, pathPath);
- strcat(nFullName, "\");
- strcat(nFullName, nFileName);
- }
- char* afSettings::tmpFullPathPath(const char* nFileName, const char* nExt)
- {
- static char fullPath[_MAX_PATH];
- extendToPathPath(nFileName, fullPath);
- if(nExt)
- strcat(fullPath, nExt);
- return fullPath;
- }
- void afSettings::extendToLevelPath(const char* nFileName, char* nFullName)
- {
- strcpy(nFullName, pathLevel);
- strcat(nFullName, "\");
- strcat(nFullName, nFileName);
- }
- char* afSettings::tmpFullLevelPath(const char* nFileName, const char* nExt)
- {
- static char fullPath[_MAX_PATH];
- extendToLevelPath(nFileName, fullPath);
- if(nExt)
- strcat(fullPath, nExt);
- return fullPath;
- }
- void afSettings::extendToMD2Path(const char* nFileName, char* nFullName)
- {
- strcpy(nFullName, pathMD2);
- strcat(nFullName, "\");
- strcat(nFullName, nFileName);
- }
- char* afSettings::tmpFullMD2Path(const char* nFileName, const char* nExt)
- {
- static char fullPath[_MAX_PATH];
- extendToMD2Path(nFileName, fullPath);
- if(nExt)
- strcat(fullPath, nExt);
- return fullPath;
- }
- void afSettings::extendToOBJPath(const char* nFileName, char* nFullName)
- {
- strcpy(nFullName, pathOBJ);
- strcat(nFullName, "\");
- strcat(nFullName, nFileName);
- }
- char* afSettings::tmpFullOBJPath(const char* nFileName, const char* nExt)
- {
- static char fullPath[_MAX_PATH];
- extendToOBJPath(nFileName, fullPath);
- if(nExt)
- strcat(fullPath, nExt);
- return fullPath;
- }
- void afSettings::extendToPsPath(const char* nFileName, char* nFullName)
- {
- strcpy(nFullName, pathPS);
- strcat(nFullName, "\");
- strcat(nFullName, nFileName);
- }
- char* afSettings::tmpFullPsPath(const char* nFileName, const char* nExt)
- {
- static char fullPath[_MAX_PATH];
- extendToAniPath(nFileName, fullPath);
- if(nExt)
- strcat(fullPath, nExt);
- return fullPath;
- }
- void afSettings::extendToTerrainPath(const char* nFileName, char* nFullName)
- {
- strcpy(nFullName, pathTerrain);
- strcat(nFullName, "\");
- strcat(nFullName, nFileName);
- }
- char* afSettings::tmpFullTerrainPath(const char* nFileName, const char* nExt)
- {
- static char fullPath[_MAX_PATH];
- extendToTerrainPath(nFileName, fullPath);
- if(nExt)
- strcat(fullPath, nExt);
- return fullPath;
- }
- void afSettings::extendToTexturePath(const char* nFileName, char* nFullName)
- {
- strcpy(nFullName, pathTex);
- strcat(nFullName, "\");
- strcat(nFullName, nFileName);
- }
- char* afSettings::tmpFullTexturePath(const char* nFileName, const char* nExt)
- {
- static char fullPath[_MAX_PATH];
- extendToTexturePath(nFileName, fullPath);
- if(nExt)
- strcat(fullPath, nExt);
- return fullPath;
- }
- void afSettings::extendToBspTexPath(const char* nFileName, char* nFullName)
- {
- strcpy(nFullName, pathBspTex);
- strcat(nFullName, "\");
- strcat(nFullName, nFileName);
- }
- char* afSettings::tmpFullBspTexPath(const char* nFileName, const char* nExt)
- {
- static char fullPath[_MAX_PATH];
- extendToBspTexPath(nFileName, fullPath);
- if(nExt)
- strcat(fullPath, nExt);
- return fullPath;
- }
- void afSettings::extendToTextureMD2Path(const char* nFileName, char* nFullName)
- {
- strcpy(nFullName, pathMD2);
- strcat(nFullName, "\");
- strcat(nFullName, nFileName);
- }
- char* afSettings::tmpFullTextureMD2Path(const char* nFileName, const char* nExt)
- {
- static char fullPath[_MAX_PATH];
- extendToTextureMD2Path(nFileName, fullPath);
- if(nExt)
- strcat(fullPath, nExt);
- return fullPath;
- }