X operations(XOPS)に非常に近いFPSゲームを制作・リメイクし、成果物をオープンソースとして公開することを目的としたプロジェクトです。
Revision | 266 (tree) |
---|---|
Zeit | 2021-03-02 02:41:49 |
Autor | xops-mikan |
デバック用コンソールのコマンド処理を改善、ファイルパスの処理を関数化、人モデルのモーフィング有無切り替えを定数化。
@@ -1311,3 +1311,17 @@ | ||
1311 | 1311 | } |
1312 | 1312 | return 1; |
1313 | 1313 | } |
1314 | + | |
1315 | +//! @brief ファイルパスからファイル名を取り除く | |
1316 | +//! @param path ファイルパス(ポインタ) | |
1317 | +//! @param dir ディレクトリ名を受け取るポインタ | |
1318 | +void GetFileDirectory(char *path, char *dir) | |
1319 | +{ | |
1320 | + strcpy(dir, path); | |
1321 | + | |
1322 | + //終端から'\\'か'/'を探し、'\0'に置き換える | |
1323 | + for(int i=strlen(dir)-1; i>0; i--){ | |
1324 | + if( dir[i] == '\\' ){ dir[i+1] = '\0'; break; } | |
1325 | + if( dir[i] == '/' ){ dir[i+1] = '\0'; break; } | |
1326 | + } | |
1327 | +} | |
\ No newline at end of file |
@@ -220,5 +220,6 @@ | ||
220 | 220 | }; |
221 | 221 | |
222 | 222 | int DeleteLinefeed(char str[]); |
223 | +void GetFileDirectory(char *path, char *dir); | |
223 | 224 | |
224 | 225 | #endif |
\ No newline at end of file |
@@ -1703,13 +1703,7 @@ | ||
1703 | 1703 | collisionflag = MIFdata.GetCollisionFlag(); |
1704 | 1704 | DarkScreenFlag = MIFdata.GetScreenFlag(); |
1705 | 1705 | |
1706 | - strcpy(path, bdata); | |
1707 | - for(int i=strlen(path)-1; i>0; i--){ | |
1708 | - if( path[i] == '\\' ){ | |
1709 | - path[i+1] = '\0'; | |
1710 | - break; | |
1711 | - } | |
1712 | - } | |
1706 | + GetFileDirectory(bdata, path); | |
1713 | 1707 | } |
1714 | 1708 | |
1715 | 1709 | //追加小物を読み込む |
@@ -1834,14 +1828,7 @@ | ||
1834 | 1828 | } |
1835 | 1829 | else{ |
1836 | 1830 | MIFdata.GetDatafilePath(bdata, pdata); |
1837 | - | |
1838 | - strcpy(path, bdata); | |
1839 | - for(int i=strlen(path)-1; i>0; i--){ | |
1840 | - if( path[i] == '\\' ){ | |
1841 | - path[i+1] = '\0'; | |
1842 | - break; | |
1843 | - } | |
1844 | - } | |
1831 | + GetFileDirectory(bdata, path); | |
1845 | 1832 | } |
1846 | 1833 | |
1847 | 1834 | //追加小物を解放⇒読み込む |
@@ -3398,12 +3385,9 @@ | ||
3398 | 3385 | //! @return 取得:true 判定外:false |
3399 | 3386 | bool maingame::GetCommandNum(char *cmd, int *num) |
3400 | 3387 | { |
3401 | - char str[MAX_CONSOLELEN]; | |
3402 | - | |
3403 | 3388 | //コマンド名を調べる |
3404 | - strcpy(str, NewCommand); | |
3405 | - str[ strlen(cmd) ] = '\0'; | |
3406 | - if( strcmp(str, cmd) != 0 ){ return false; } | |
3389 | + if( memcmp(NewCommand, cmd, strlen(cmd)) != 0 ){ return false; } | |
3390 | + if( NewCommand[strlen(cmd)] != ' ' ){ return false; } | |
3407 | 3391 | |
3408 | 3392 | //「コマンド名_X」分の文字数に達しているかどうか |
3409 | 3393 | if( strlen(cmd)+2 > strlen(NewCommand) ){ return false; } |
@@ -4036,14 +4020,7 @@ | ||
4036 | 4020 | } |
4037 | 4021 | else{ |
4038 | 4022 | MIFdata.GetDatafilePath(bdata, pdata); |
4039 | - | |
4040 | - strcpy(path, bdata); | |
4041 | - for(int i=strlen(path)-1; i>0; i--){ | |
4042 | - if( path[i] == '\\' ){ | |
4043 | - path[i+1] = '\0'; | |
4044 | - break; | |
4045 | - } | |
4046 | - } | |
4023 | + GetFileDirectory(bdata, path); | |
4047 | 4024 | } |
4048 | 4025 | |
4049 | 4026 | //ブロックデータ初期化 |
@@ -237,7 +237,7 @@ | ||
237 | 237 | bool tag; //!< オブジェクトのタグを表示 |
238 | 238 | bool radar; //!< 簡易レーダー表示 |
239 | 239 | bool wireframe; //!< マップをワイヤーフレーム表示 |
240 | - bool nomodel; //!< モデル描画フラグ | |
240 | + bool nomodel; //!< モデル描画フラグ | |
241 | 241 | bool CenterLine; //!< 3D空間に中心線を表示 |
242 | 242 | bool Camera_Blind; //!< 目隠し描画 |
243 | 243 | bool Camera_F1mode; //!< カメラF1モード |
@@ -160,32 +160,31 @@ | ||
160 | 160 | human_runmodel[8] = d3dg->LoadModel("data\\model\\run05.x"); |
161 | 161 | human_runmodel[10] = d3dg->LoadModel("data\\model\\run06.x"); |
162 | 162 | |
163 | - if( 1 ){ | |
164 | - //モーフィング処理を実行する | |
165 | - human_walkmodel[1] = d3dg->MorphingModel(human_walkmodel[0], human_walkmodel[2]); | |
166 | - human_walkmodel[3] = d3dg->MorphingModel(human_walkmodel[2], human_walkmodel[4]); | |
167 | - human_walkmodel[5] = d3dg->MorphingModel(human_walkmodel[4], human_walkmodel[6]); | |
168 | - human_walkmodel[7] = d3dg->MorphingModel(human_walkmodel[6], human_walkmodel[0]); | |
169 | - human_runmodel[1] = d3dg->MorphingModel(human_runmodel[0], human_runmodel[2]); | |
170 | - human_runmodel[3] = d3dg->MorphingModel(human_runmodel[2], human_runmodel[4]); | |
171 | - human_runmodel[5] = d3dg->MorphingModel(human_runmodel[4], human_runmodel[6]); | |
172 | - human_runmodel[7] = d3dg->MorphingModel(human_runmodel[6], human_runmodel[8]); | |
173 | - human_runmodel[9] = d3dg->MorphingModel(human_runmodel[8], human_runmodel[10]); | |
174 | - human_runmodel[11] = d3dg->MorphingModel(human_runmodel[10], human_runmodel[0]); | |
175 | - } | |
176 | - else{ | |
177 | - //モーフィング処理を実行しない | |
178 | - human_walkmodel[1] = human_walkmodel[0]; | |
179 | - human_walkmodel[3] = human_walkmodel[2]; | |
180 | - human_walkmodel[5] = human_walkmodel[4]; | |
181 | - human_walkmodel[7] = human_walkmodel[6]; | |
182 | - human_runmodel[1] = human_runmodel[0]; | |
183 | - human_runmodel[3] = human_runmodel[2]; | |
184 | - human_runmodel[5] = human_runmodel[4]; | |
185 | - human_runmodel[7] = human_runmodel[6]; | |
186 | - human_runmodel[9] = human_runmodel[8]; | |
187 | - human_runmodel[11] = human_runmodel[10]; | |
188 | - } | |
163 | +#ifdef ENABLE_HUMANMODEL_MORPHING | |
164 | + //モーフィング処理を実行する | |
165 | + human_walkmodel[1] = d3dg->MorphingModel(human_walkmodel[0], human_walkmodel[2]); | |
166 | + human_walkmodel[3] = d3dg->MorphingModel(human_walkmodel[2], human_walkmodel[4]); | |
167 | + human_walkmodel[5] = d3dg->MorphingModel(human_walkmodel[4], human_walkmodel[6]); | |
168 | + human_walkmodel[7] = d3dg->MorphingModel(human_walkmodel[6], human_walkmodel[0]); | |
169 | + human_runmodel[1] = d3dg->MorphingModel(human_runmodel[0], human_runmodel[2]); | |
170 | + human_runmodel[3] = d3dg->MorphingModel(human_runmodel[2], human_runmodel[4]); | |
171 | + human_runmodel[5] = d3dg->MorphingModel(human_runmodel[4], human_runmodel[6]); | |
172 | + human_runmodel[7] = d3dg->MorphingModel(human_runmodel[6], human_runmodel[8]); | |
173 | + human_runmodel[9] = d3dg->MorphingModel(human_runmodel[8], human_runmodel[10]); | |
174 | + human_runmodel[11] = d3dg->MorphingModel(human_runmodel[10], human_runmodel[0]); | |
175 | +#else | |
176 | + //モーフィング処理を実行しない | |
177 | + human_walkmodel[1] = human_walkmodel[0]; | |
178 | + human_walkmodel[3] = human_walkmodel[2]; | |
179 | + human_walkmodel[5] = human_walkmodel[4]; | |
180 | + human_walkmodel[7] = human_walkmodel[6]; | |
181 | + human_runmodel[1] = human_runmodel[0]; | |
182 | + human_runmodel[3] = human_runmodel[2]; | |
183 | + human_runmodel[5] = human_runmodel[4]; | |
184 | + human_runmodel[7] = human_runmodel[6]; | |
185 | + human_runmodel[9] = human_runmodel[8]; | |
186 | + human_runmodel[11] = human_runmodel[10]; | |
187 | +#endif | |
189 | 188 | |
190 | 189 | return 0; |
191 | 190 | } |
@@ -39,6 +39,8 @@ | ||
39 | 39 | |
40 | 40 | #define MAX_LOADHUMANTEXTURE 10 //!< 人のテクスチャを読み込む最大枚数 |
41 | 41 | |
42 | +#define ENABLE_HUMANMODEL_MORPHING //!< 人モデルのモーフィング処理有効化(コメント化で機能無効) | |
43 | + | |
42 | 44 | #ifndef H_LAYERLEVEL |
43 | 45 | #define H_LAYERLEVEL 2 //!< Select include file. |
44 | 46 | #endif |