X operations(XOPS)に非常に近いFPSゲームを制作・リメイクし、成果物をオープンソースとして公開することを目的としたプロジェクトです。
| Revision | 211 (tree) |
|---|---|
| Time | 2018-11-25 17:13:06 |
| Author | |
追加小物の管理方法を変更(複数読み込む改版が容易な設計に)、FF有効化フラグの管理方法を変更
| @@ -677,17 +677,14 @@ | ||
| 677 | 677 | strcpy(briefingtext, ""); |
| 678 | 678 | collision = false; |
| 679 | 679 | screen = false; |
| 680 | - strcpy(addsmallobject_modelpath, ""); | |
| 681 | - strcpy(addsmallobject_texturepath, ""); | |
| 682 | - addsmallobject_decide = 0; | |
| 683 | - addsmallobject_hp = 0; | |
| 684 | - strcpy(addsmallobject_soundpath, ""); | |
| 685 | - addsmallobject_jump = 0; | |
| 680 | + AddSmallObjectData = new addsmallobject[MAX_ADDSMALLOBJECT]; | |
| 686 | 681 | } |
| 687 | 682 | |
| 688 | 683 | //! @brief ディストラクタ |
| 689 | 684 | MIFInterface::~MIFInterface() |
| 690 | -{} | |
| 685 | +{ | |
| 686 | + if( AddSmallObjectData != NULL ){ delete [] AddSmallObjectData; } | |
| 687 | +} | |
| 691 | 688 | |
| 692 | 689 | //! @brief データファイルを読みこむ |
| 693 | 690 | //! @param fname ファイル名 |
| @@ -741,12 +738,14 @@ | ||
| 741 | 738 | |
| 742 | 739 | |
| 743 | 740 | //追加小物情報を初期値へ |
| 744 | - strcpy(addsmallobject_modelpath, ""); | |
| 745 | - strcpy(addsmallobject_texturepath, ""); | |
| 746 | - addsmallobject_decide = 0; | |
| 747 | - addsmallobject_hp = 0; | |
| 748 | - strcpy(addsmallobject_soundpath, ""); | |
| 749 | - addsmallobject_jump = 0; | |
| 741 | + for(int i=0; i<MAX_ADDSMALLOBJECT; i++){ | |
| 742 | + strcpy(AddSmallObjectData[i].modelpath, ""); | |
| 743 | + strcpy(AddSmallObjectData[i].texturepath, ""); | |
| 744 | + AddSmallObjectData[i].decide = 0; | |
| 745 | + AddSmallObjectData[i].hp = 0; | |
| 746 | + strcpy(AddSmallObjectData[i].soundpath, ""); | |
| 747 | + AddSmallObjectData[i].jump = 0; | |
| 748 | + } | |
| 750 | 749 | |
| 751 | 750 | //何かしらの追加小物情報ファイルが指定されていれば |
| 752 | 751 | if( (strcmp(addsmallobject_path, "") != 0)&&(strcmp(addsmallobject_path, "!") != 0) ){ |
| @@ -910,6 +909,13 @@ | ||
| 910 | 909 | int MIFInterface::LoadAddSmallObjectFiledata(char *fname) |
| 911 | 910 | { |
| 912 | 911 | FILE *fp; |
| 912 | + char str1[_MAX_PATH]; | |
| 913 | + char str2[_MAX_PATH]; | |
| 914 | + char str3[32]; | |
| 915 | + char str4[32]; | |
| 916 | + char str5[_MAX_PATH]; | |
| 917 | + char str6[32]; | |
| 918 | + | |
| 913 | 919 | char str[64]; |
| 914 | 920 | |
| 915 | 921 | #ifdef ENABLE_PATH_DELIMITER_SLASH |
| @@ -925,42 +931,60 @@ | ||
| 925 | 931 | //ファイルを開く |
| 926 | 932 | fp = fopen( fname, "r" ); |
| 927 | 933 | if( fp != NULL ){ |
| 928 | - //モデルデータパス | |
| 929 | - fgets(addsmallobject_modelpath, _MAX_PATH, fp); | |
| 930 | - DeleteLinefeed(addsmallobject_modelpath); | |
| 934 | + for(int i=0; i<MAX_ADDSMALLOBJECT; i++){ | |
| 935 | + //6行取得 | |
| 936 | + fgets(str1, _MAX_PATH, fp); | |
| 937 | + fgets(str2, _MAX_PATH, fp); | |
| 938 | + fgets(str3, 16, fp); | |
| 939 | + fgets(str4, 16, fp); | |
| 940 | + fgets(str5, _MAX_PATH, fp); | |
| 941 | + fgets(str6, 16, fp); | |
| 931 | 942 | |
| 932 | - //テクスチャパス | |
| 933 | - fgets(addsmallobject_texturepath, _MAX_PATH, fp); | |
| 934 | - DeleteLinefeed(addsmallobject_texturepath); | |
| 943 | + //6行すべて取得できなければ失敗 | |
| 944 | + if( (str1 == NULL)||(str2 == NULL)||(str3 == NULL)||(str4 == NULL)||(str5 == NULL)||(str6 == NULL) ){ | |
| 945 | + break; | |
| 946 | + } | |
| 935 | 947 | |
| 936 | - //当たり判定の大きさ | |
| 937 | - fgets(str, 16, fp); | |
| 938 | - DeleteLinefeed(str); | |
| 939 | - addsmallobject_decide = atoi(str); | |
| 948 | + | |
| 949 | + //モデルデータパス | |
| 950 | + DeleteLinefeed(str1); | |
| 951 | + strcpy(AddSmallObjectData[i].modelpath, str1); | |
| 952 | + | |
| 953 | + //テクスチャパス | |
| 954 | + DeleteLinefeed(str2); | |
| 955 | + strcpy(AddSmallObjectData[i].texturepath, str2); | |
| 956 | + | |
| 957 | + //当たり判定の大きさ | |
| 958 | + DeleteLinefeed(str3); | |
| 959 | + AddSmallObjectData[i].decide = atoi(str3); | |
| 940 | 960 | #ifdef ENABLE_ADDOBJ_PARAM8BIT |
| 941 | - addsmallobject_decide = addsmallobject_decide & 0x0000007F; | |
| 961 | + AddSmallObjectData[i].decide = AddSmallObjectData[i].decide & 0x0000007F; | |
| 942 | 962 | #endif |
| 943 | 963 | |
| 944 | - //耐久力 | |
| 945 | - fgets(str, 16, fp); | |
| 946 | - DeleteLinefeed(str); | |
| 947 | - addsmallobject_hp = atoi(str); | |
| 964 | + //耐久力 | |
| 965 | + DeleteLinefeed(str4); | |
| 966 | + AddSmallObjectData[i].hp = atoi(str4); | |
| 948 | 967 | #ifdef ENABLE_ADDOBJ_PARAM8BIT |
| 949 | - addsmallobject_hp = addsmallobject_hp & 0x0000007F; | |
| 968 | + AddSmallObjectData[i].hp = AddSmallObjectData[i].hp & 0x0000007F; | |
| 950 | 969 | #endif |
| 951 | 970 | |
| 952 | - //サウンドデータパス | |
| 953 | - fgets(addsmallobject_soundpath, _MAX_PATH, fp); | |
| 954 | - DeleteLinefeed(addsmallobject_soundpath); | |
| 971 | + //サウンドデータパス | |
| 972 | + DeleteLinefeed(str5); | |
| 973 | + strcpy(AddSmallObjectData[i].soundpath, str5); | |
| 955 | 974 | |
| 956 | - //飛び具合 | |
| 957 | - fgets(str, 16, fp); | |
| 958 | - DeleteLinefeed(str); | |
| 959 | - addsmallobject_jump = atoi(str); | |
| 975 | + //飛び具合 | |
| 976 | + DeleteLinefeed(str6); | |
| 977 | + AddSmallObjectData[i].jump = atoi(str6); | |
| 960 | 978 | #ifdef ENABLE_ADDOBJ_PARAM8BIT |
| 961 | - addsmallobject_jump = addsmallobject_jump & 0x000000FF; | |
| 979 | + AddSmallObjectData[i].jump = AddSmallObjectData[i].jump & 0x000000FF; | |
| 962 | 980 | #endif |
| 963 | 981 | |
| 982 | + //次の追加小物情報の前にある、ダミー 1行を読み出し | |
| 983 | + if( i+1 < MAX_ADDSMALLOBJECT ){ | |
| 984 | + fgets(str, 32, fp); | |
| 985 | + } | |
| 986 | + } | |
| 987 | + | |
| 964 | 988 | //ファイルハンドルを開放 |
| 965 | 989 | fclose( fp ); |
| 966 | 990 |
| @@ -1060,45 +1084,57 @@ | ||
| 1060 | 1084 | } |
| 1061 | 1085 | |
| 1062 | 1086 | //! @brief 追加小物のモデルデータパスを取得 |
| 1087 | +//! @param id データ番号(通常は 0 固定) | |
| 1063 | 1088 | //! @return モデルデータパスのポインタ(最大:_MAX_PATH) |
| 1064 | -char* MIFInterface::GetAddSmallobjectModelPath() | |
| 1089 | +char* MIFInterface::GetAddSmallobjectModelPath(int id) | |
| 1065 | 1090 | { |
| 1066 | - return addsmallobject_modelpath; | |
| 1091 | + if( (id < 0)||(MAX_ADDSMALLOBJECT-1 < id) ){ return NULL; } | |
| 1092 | + return AddSmallObjectData[id].modelpath; | |
| 1067 | 1093 | } |
| 1068 | 1094 | |
| 1069 | 1095 | //! @brief 追加小物のテクスチャパスを取得 |
| 1096 | +//! @param id データ番号(通常は 0 固定) | |
| 1070 | 1097 | //! @return テクスチャパスのポインタ(最大:_MAX_PATH) |
| 1071 | -char* MIFInterface::GetAddSmallobjectTexturePath() | |
| 1098 | +char* MIFInterface::GetAddSmallobjectTexturePath(int id) | |
| 1072 | 1099 | { |
| 1073 | - return addsmallobject_texturepath; | |
| 1100 | + if( (id < 0)||(MAX_ADDSMALLOBJECT-1 < id) ){ return NULL; } | |
| 1101 | + return AddSmallObjectData[id].texturepath; | |
| 1074 | 1102 | } |
| 1075 | 1103 | |
| 1076 | 1104 | //! @brief 追加小物の当たり判定の大きさを取得 |
| 1105 | +//! @param id データ番号(通常は 0 固定) | |
| 1077 | 1106 | //! @return 当たり判定の大きさ |
| 1078 | -int MIFInterface::GetAddSmallobjectDecide() | |
| 1107 | +int MIFInterface::GetAddSmallobjectDecide(int id) | |
| 1079 | 1108 | { |
| 1080 | - return addsmallobject_decide; | |
| 1109 | + if( (id < 0)||(MAX_ADDSMALLOBJECT-1 < id) ){ return 0; } | |
| 1110 | + return AddSmallObjectData[id].decide; | |
| 1081 | 1111 | } |
| 1082 | 1112 | |
| 1083 | 1113 | //! @brief 追加小物の耐久力を取得 |
| 1114 | +//! @param id データ番号(通常は 0 固定) | |
| 1084 | 1115 | //! @return 耐久力 |
| 1085 | -int MIFInterface::GetAddSmallobjectHP() | |
| 1116 | +int MIFInterface::GetAddSmallobjectHP(int id) | |
| 1086 | 1117 | { |
| 1087 | - return addsmallobject_hp; | |
| 1118 | + if( (id < 0)||(MAX_ADDSMALLOBJECT-1 < id) ){ return 0; } | |
| 1119 | + return AddSmallObjectData[id].hp; | |
| 1088 | 1120 | } |
| 1089 | 1121 | |
| 1090 | 1122 | //! @brief 追加小物のサウンドデータパスを取得 |
| 1123 | +//! @param id データ番号(通常は 0 固定) | |
| 1091 | 1124 | //! @return サウンドデータパスのポインタ(最大:_MAX_PATH) |
| 1092 | -char* MIFInterface::GetAddSmallobjectSoundPath() | |
| 1125 | +char* MIFInterface::GetAddSmallobjectSoundPath(int id) | |
| 1093 | 1126 | { |
| 1094 | - return addsmallobject_soundpath; | |
| 1127 | + if( (id < 0)||(MAX_ADDSMALLOBJECT-1 < id) ){ return NULL; } | |
| 1128 | + return AddSmallObjectData[id].soundpath; | |
| 1095 | 1129 | } |
| 1096 | 1130 | |
| 1097 | 1131 | //! @brief 追加小物の飛び具合を取得 |
| 1132 | +//! @param id データ番号(通常は 0 固定) | |
| 1098 | 1133 | //! @return 飛び具合 |
| 1099 | -int MIFInterface::GetAddSmallobjectJump() | |
| 1134 | +int MIFInterface::GetAddSmallobjectJump(int id) | |
| 1100 | 1135 | { |
| 1101 | - return addsmallobject_jump; | |
| 1136 | + if( (id < 0)||(MAX_ADDSMALLOBJECT-1 < id) ){ return 0; } | |
| 1137 | + return AddSmallObjectData[id].jump; | |
| 1102 | 1138 | } |
| 1103 | 1139 | |
| 1104 | 1140 | //! @brief コンストラクタ |
| @@ -37,6 +37,11 @@ | ||
| 37 | 37 | |
| 38 | 38 | #define MAX_POINTS 200 //!< 最大ポイント数 |
| 39 | 39 | |
| 40 | +//! @brief 追加小物の数 | |
| 41 | +//! @attention 設定値を増やす場合、MAX_MODEL・MAX_TEXTURE・MAX_LOADSOUNDの値も適切に見直すこと | |
| 42 | +//! @note 追加小物設定ファイルの下部に、続けて次の追加小物の設定値を記載します。ただし、各追加小物の設定値の間にダミー行("//"推奨)を挿んでください。 | |
| 43 | +#define MAX_ADDSMALLOBJECT 1 | |
| 44 | + | |
| 40 | 45 | #define MAX_POINTMESSAGES 16 //!< .msgファイルの最大メッセージ数 |
| 41 | 46 | #define MAX_POINTMESSAGEBYTE (71+2) //!< .msgファイル 1行あたりの最大バイト数 |
| 42 | 47 |
| @@ -85,6 +90,16 @@ | ||
| 85 | 90 | signed char p4; //!< Param |
| 86 | 91 | }; |
| 87 | 92 | |
| 93 | +//! 追加小物用の構造体 | |
| 94 | +struct addsmallobject{ | |
| 95 | + char modelpath[_MAX_PATH]; //!< モデルデータパス | |
| 96 | + char texturepath[_MAX_PATH]; //!< テクスチャパス | |
| 97 | + int decide; //!< 当たり判定の大きさ | |
| 98 | + int hp; //!< 耐久力 | |
| 99 | + char soundpath[_MAX_PATH]; //!< サウンドデータパス | |
| 100 | + int jump; //!< 飛び具合 | |
| 101 | +}; | |
| 102 | + | |
| 88 | 103 | //! @brief データを管理するクラス(基底クラス) |
| 89 | 104 | //! @details ゲームのデータを、ファイルから読み込み処理するクラス群の基底クラスです。 |
| 90 | 105 | class DataInterface |
| @@ -157,12 +172,7 @@ | ||
| 157 | 172 | char briefingtext[816]; //!< ブリーフィング文章・本文 |
| 158 | 173 | bool collision; //!< 当たり判定を多めに行う |
| 159 | 174 | bool screen; //!< 画面を暗めにする |
| 160 | - char addsmallobject_modelpath[_MAX_PATH]; //!< 追加小物のモデルデータパス | |
| 161 | - char addsmallobject_texturepath[_MAX_PATH]; //!< 追加小物のテクスチャパス | |
| 162 | - int addsmallobject_decide; //!< 追加小物の当たり判定の大きさ | |
| 163 | - int addsmallobject_hp; //!< 追加小物の耐久力 | |
| 164 | - char addsmallobject_soundpath[_MAX_PATH]; //!< 追加小物のサウンドデータパス | |
| 165 | - int addsmallobject_jump; //!< 追加小物の飛び具合 | |
| 175 | + addsmallobject *AddSmallObjectData; //!< 追加小物の情報 | |
| 166 | 176 | |
| 167 | 177 | int LoadDefaultTextFiledata(char *fname); |
| 168 | 178 | int LoadMissionInfoFiledata(char *fname); |
| @@ -182,12 +192,12 @@ | ||
| 182 | 192 | bool GetCollisionFlag(); |
| 183 | 193 | bool GetScreenFlag(); |
| 184 | 194 | char* GetAddSmallobjectFile(); |
| 185 | - char* GetAddSmallobjectModelPath(); | |
| 186 | - char* GetAddSmallobjectTexturePath(); | |
| 187 | - int GetAddSmallobjectDecide(); | |
| 188 | - int GetAddSmallobjectHP(); | |
| 189 | - char* GetAddSmallobjectSoundPath(); | |
| 190 | - int GetAddSmallobjectJump(); | |
| 195 | + char* GetAddSmallobjectModelPath(int id); | |
| 196 | + char* GetAddSmallobjectTexturePath(int id); | |
| 197 | + int GetAddSmallobjectDecide(int id); | |
| 198 | + int GetAddSmallobjectHP(int id); | |
| 199 | + char* GetAddSmallobjectSoundPath(int id); | |
| 200 | + int GetAddSmallobjectJump(int id); | |
| 191 | 201 | }; |
| 192 | 202 | |
| 193 | 203 | //! @brief ADDONリストを管理するクラス |
| @@ -1125,7 +1125,9 @@ | ||
| 1125 | 1125 | } |
| 1126 | 1126 | |
| 1127 | 1127 | //追加小物を読み込む |
| 1128 | - Resource.LoadAddSmallObject(MIFdata.GetAddSmallobjectModelPath(), MIFdata.GetAddSmallobjectTexturePath(), MIFdata.GetAddSmallobjectSoundPath()); | |
| 1128 | + for(int i=0; i<MAX_ADDSMALLOBJECT; i++){ | |
| 1129 | + Resource.LoadAddSmallObject(i, MIFdata.GetAddSmallobjectModelPath(i), MIFdata.GetAddSmallobjectTexturePath(i), MIFdata.GetAddSmallobjectSoundPath(i)); | |
| 1130 | + } | |
| 1129 | 1131 | |
| 1130 | 1132 | //ブロックデータ読み込み |
| 1131 | 1133 | blockflag = BlockData.LoadFiledata(bdata); |
| @@ -1253,8 +1255,10 @@ | ||
| 1253 | 1255 | } |
| 1254 | 1256 | |
| 1255 | 1257 | //追加小物を解放⇒読み込む |
| 1256 | - Resource.CleanupAddSmallObject(); | |
| 1257 | - Resource.LoadAddSmallObject(MIFdata.GetAddSmallobjectModelPath(), MIFdata.GetAddSmallobjectTexturePath(), MIFdata.GetAddSmallobjectSoundPath()); | |
| 1258 | + for(int i=0; i<MAX_ADDSMALLOBJECT; i++){ | |
| 1259 | + Resource.CleanupAddSmallObject(i); | |
| 1260 | + Resource.LoadAddSmallObject(i, MIFdata.GetAddSmallobjectModelPath(i), MIFdata.GetAddSmallobjectTexturePath(i), MIFdata.GetAddSmallobjectSoundPath(i)); | |
| 1261 | + } | |
| 1258 | 1262 | |
| 1259 | 1263 | //ブロックデータ初期化 |
| 1260 | 1264 | d3dg->LoadMapdata(&BlockData, path); |
| @@ -3589,12 +3593,16 @@ | ||
| 3589 | 3593 | |
| 3590 | 3594 | //FF(同士討ち)有効化 |
| 3591 | 3595 | if( strcmp(NewCommand, "ff") == 0 ){ |
| 3592 | - if( ObjMgr.GetFriendlyFireFlag() == false ){ | |
| 3593 | - ObjMgr.SetFriendlyFireFlag(true); | |
| 3596 | + if( ObjMgr.GetFriendlyFireFlag(0) == false ){ //とりあえず No.0 で判定 | |
| 3597 | + for(int i=0; i<MAX_HUMAN; i++){ | |
| 3598 | + ObjMgr.SetFriendlyFireFlag(i, true); | |
| 3599 | + } | |
| 3594 | 3600 | AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "Enable Friendly Fire."); |
| 3595 | 3601 | } |
| 3596 | 3602 | else{ |
| 3597 | - ObjMgr.SetFriendlyFireFlag(false); | |
| 3603 | + for(int i=0; i<MAX_HUMAN; i++){ | |
| 3604 | + ObjMgr.SetFriendlyFireFlag(i, false); | |
| 3605 | + } | |
| 3598 | 3606 | AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "Disable Friendly Fire."); |
| 3599 | 3607 | } |
| 3600 | 3608 | } |
| @@ -3836,7 +3844,9 @@ | ||
| 3836 | 3844 | ObjMgr.Cleanup(); |
| 3837 | 3845 | |
| 3838 | 3846 | //追加小物を解放 |
| 3839 | - Resource.CleanupAddSmallObject(); | |
| 3847 | + for(int i=0; i<MAX_ADDSMALLOBJECT; i++){ | |
| 3848 | + Resource.CleanupAddSmallObject(i); | |
| 3849 | + } | |
| 3840 | 3850 | |
| 3841 | 3851 | //背景空解放 |
| 3842 | 3852 | Resource.CleanupSkyModelTexture(); |
| @@ -2192,9 +2192,9 @@ | ||
| 2192 | 2192 | add_ry = 0.0f; |
| 2193 | 2193 | jump_cnt = 0; |
| 2194 | 2194 | |
| 2195 | - if( id_param == TOTAL_PARAMETERINFO_SMALLOBJECT+1 -1 ){ | |
| 2195 | + if( (TOTAL_PARAMETERINFO_SMALLOBJECT <= id_param)&&(id_param <= (TOTAL_PARAMETERINFO_SMALLOBJECT + MAX_ADDSMALLOBJECT -1)) ){ | |
| 2196 | 2196 | if( MIFdata != NULL ){ |
| 2197 | - hp = MIFdata->GetAddSmallobjectHP(); | |
| 2197 | + hp = MIFdata->GetAddSmallobjectHP(id_param - TOTAL_PARAMETERINFO_SMALLOBJECT); | |
| 2198 | 2198 | } |
| 2199 | 2199 | } |
| 2200 | 2200 | else{ |
| @@ -2239,8 +2239,8 @@ | ||
| 2239 | 2239 | //下方向に当たり判定 |
| 2240 | 2240 | if( CollD->CheckALLBlockIntersectRay(pos_x, pos_y + COLLISION_ADDSIZE, pos_z, 0, -1, 0, NULL, NULL, &Dist, 1000.0f) == true ){ |
| 2241 | 2241 | //当たり判定の大きさを取得 |
| 2242 | - if( id_parameter == TOTAL_PARAMETERINFO_SMALLOBJECT+1 -1 ){ | |
| 2243 | - Dist -= (float)MIFdata->GetAddSmallobjectDecide()/10.0f; | |
| 2242 | + if( (TOTAL_PARAMETERINFO_SMALLOBJECT <= id_parameter)&&(id_parameter <= (TOTAL_PARAMETERINFO_SMALLOBJECT + MAX_ADDSMALLOBJECT -1)) ){ | |
| 2243 | + Dist -= (float)MIFdata->GetAddSmallobjectDecide(id_parameter - TOTAL_PARAMETERINFO_SMALLOBJECT)/10.0f; | |
| 2244 | 2244 | } |
| 2245 | 2245 | else{ |
| 2246 | 2246 | if( Param->GetSmallObject(id_parameter, &ParamData) == 0 ){ |
| @@ -2287,8 +2287,8 @@ | ||
| 2287 | 2287 | int jump; |
| 2288 | 2288 | |
| 2289 | 2289 | //飛び具合を取得 |
| 2290 | - if( id_parameter == TOTAL_PARAMETERINFO_SMALLOBJECT+1 -1 ){ | |
| 2291 | - jump = MIFdata->GetAddSmallobjectJump(); | |
| 2290 | + if( (TOTAL_PARAMETERINFO_SMALLOBJECT <= id_parameter)&&(id_parameter <= (TOTAL_PARAMETERINFO_SMALLOBJECT + MAX_ADDSMALLOBJECT -1)) ){ | |
| 2291 | + jump = MIFdata->GetAddSmallobjectJump(id_parameter - TOTAL_PARAMETERINFO_SMALLOBJECT); | |
| 2292 | 2292 | } |
| 2293 | 2293 | else{ |
| 2294 | 2294 | SmallObjectParameter paramdata; |
| @@ -2318,8 +2318,8 @@ | ||
| 2318 | 2318 | int jump; |
| 2319 | 2319 | |
| 2320 | 2320 | //飛び具合を取得 |
| 2321 | - if( id_parameter == TOTAL_PARAMETERINFO_SMALLOBJECT+1 -1 ){ | |
| 2322 | - jump = MIFdata->GetAddSmallobjectJump(); | |
| 2321 | + if( (TOTAL_PARAMETERINFO_SMALLOBJECT <= id_parameter)&&(id_parameter <= (TOTAL_PARAMETERINFO_SMALLOBJECT + MAX_ADDSMALLOBJECT -1)) ){ | |
| 2322 | + jump = MIFdata->GetAddSmallobjectJump(id_parameter - TOTAL_PARAMETERINFO_SMALLOBJECT); | |
| 2323 | 2323 | } |
| 2324 | 2324 | else{ |
| 2325 | 2325 | SmallObjectParameter paramdata; |
| @@ -48,7 +48,7 @@ | ||
| 48 | 48 | Human_ShotFlag = new bool[MAX_HUMAN]; |
| 49 | 49 | BulletObj_HumanIndex = new BulletObjectHumanIndex[MAX_BULLET]; |
| 50 | 50 | AddCollisionFlag = false; |
| 51 | - FriendlyFire = false; | |
| 51 | + FriendlyFire = new bool[MAX_HUMAN]; | |
| 52 | 52 | Player_HumanID = 0; |
| 53 | 53 | Human_FrameTextureRefresh = new bool[MAX_HUMAN]; |
| 54 | 54 |
| @@ -81,6 +81,7 @@ | ||
| 81 | 81 | if( Human_headshot != NULL ){ delete [] Human_headshot; } |
| 82 | 82 | if( Human_ShotFlag != NULL ){ delete [] Human_ShotFlag; } |
| 83 | 83 | if( BulletObj_HumanIndex != NULL ){ delete [] BulletObj_HumanIndex; } |
| 84 | + if( FriendlyFire != NULL ){ delete [] FriendlyFire; } | |
| 84 | 85 | if( Human_FrameTextureRefresh != NULL ){ delete [] Human_FrameTextureRefresh; } |
| 85 | 86 | |
| 86 | 87 | if( ObjectLog != NULL ){ delete ObjectLog; } |
| @@ -726,7 +727,7 @@ | ||
| 726 | 727 | HumanIndex[i].GetPosData(&ox, &oy, &oz, NULL); |
| 727 | 728 | HumanIndex[i].GetParamData(NULL, NULL, NULL, &h_teamid); |
| 728 | 729 | |
| 729 | - if( FriendlyFire == false ){ | |
| 730 | + if( FriendlyFire[i] == false ){ | |
| 730 | 731 | //同じチーム番号(味方)なら処理しない |
| 731 | 732 | if( h_teamid == teamid ){ continue; } |
| 732 | 733 | } |
| @@ -769,8 +770,8 @@ | ||
| 769 | 770 | SmallObjectIndex[i].GetParamData(&id, NULL); |
| 770 | 771 | |
| 771 | 772 | //当たり判定の大きさを取得 |
| 772 | - if( id == TOTAL_PARAMETERINFO_SMALLOBJECT+1 -1 ){ | |
| 773 | - decide = (float)MIFdata->GetAddSmallobjectDecide()*SMALLOBJECT_COLLISIONSCALE; | |
| 773 | + if( (TOTAL_PARAMETERINFO_SMALLOBJECT <= id)&&(id <= (TOTAL_PARAMETERINFO_SMALLOBJECT + MAX_ADDSMALLOBJECT -1)) ){ | |
| 774 | + decide = (float)MIFdata->GetAddSmallobjectDecide(id - TOTAL_PARAMETERINFO_SMALLOBJECT)*SMALLOBJECT_COLLISIONSCALE; | |
| 774 | 775 | } |
| 775 | 776 | else{ |
| 776 | 777 | SmallObjectParameter Param; |
| @@ -870,8 +871,8 @@ | ||
| 870 | 871 | SmallObjectIndex[SmallObject_id].GetParamData(&id, NULL); |
| 871 | 872 | |
| 872 | 873 | //当たり判定の大きさを取得 |
| 873 | - if( id == TOTAL_PARAMETERINFO_SMALLOBJECT+1 -1 ){ | |
| 874 | - decide = (int)( (float)MIFdata->GetAddSmallobjectDecide()*SMALLOBJECT_COLLISIONSCALE ); | |
| 874 | + if( (TOTAL_PARAMETERINFO_SMALLOBJECT <= id)&&(id <= (TOTAL_PARAMETERINFO_SMALLOBJECT + MAX_ADDSMALLOBJECT -1)) ){ | |
| 875 | + decide = (int)( (float)MIFdata->GetAddSmallobjectDecide(id - TOTAL_PARAMETERINFO_SMALLOBJECT)*SMALLOBJECT_COLLISIONSCALE ); | |
| 875 | 876 | } |
| 876 | 877 | else{ |
| 877 | 878 | SmallObjectParameter Param; |
| @@ -1386,9 +1387,13 @@ | ||
| 1386 | 1387 | void ObjectManager::LoadPointData() |
| 1387 | 1388 | { |
| 1388 | 1389 | AddCollisionFlag = false; |
| 1389 | - FriendlyFire = false; | |
| 1390 | 1390 | Player_HumanID = 0; |
| 1391 | 1391 | |
| 1392 | + //FF(同士討ち)有効化フラグ設定 | |
| 1393 | + for(int i=0; i<MAX_HUMAN; i++){ | |
| 1394 | + FriendlyFire[i] = false; | |
| 1395 | + } | |
| 1396 | + | |
| 1392 | 1397 | //人のテクスチャリフレッシュフラグ初期化 |
| 1393 | 1398 | for(int i=0; i<MAX_HUMAN; i++){ |
| 1394 | 1399 | Human_FrameTextureRefresh[i] = false; |
| @@ -1595,17 +1600,21 @@ | ||
| 1595 | 1600 | } |
| 1596 | 1601 | |
| 1597 | 1602 | //! @brief FF(同士討ち)有効化フラグを取得 |
| 1603 | +//! @param id データ番号 | |
| 1598 | 1604 | //! @return フラグ |
| 1599 | -bool ObjectManager::GetFriendlyFireFlag() | |
| 1605 | +bool ObjectManager::GetFriendlyFireFlag(int id) | |
| 1600 | 1606 | { |
| 1601 | - return FriendlyFire; | |
| 1607 | + if( (id < 0)||(MAX_HUMAN-1 < id) ){ return false; } | |
| 1608 | + return FriendlyFire[id]; | |
| 1602 | 1609 | } |
| 1603 | 1610 | |
| 1604 | 1611 | //! @brief FF(同士討ち)有効化フラグを設定 |
| 1612 | +//! @param id データ番号 | |
| 1605 | 1613 | //! @param flag フラグ |
| 1606 | -void ObjectManager::SetFriendlyFireFlag(bool flag) | |
| 1614 | +void ObjectManager::SetFriendlyFireFlag(int id, bool flag) | |
| 1607 | 1615 | { |
| 1608 | - FriendlyFire = flag; | |
| 1616 | + if( (id < 0)||(MAX_HUMAN-1 < id) ){ return; } | |
| 1617 | + FriendlyFire[id] = flag; | |
| 1609 | 1618 | } |
| 1610 | 1619 | |
| 1611 | 1620 | //! @brief プレイヤー番号を取得 |
| @@ -90,7 +90,7 @@ | ||
| 90 | 90 | class BulletObjectHumanIndex *BulletObj_HumanIndex; //!< 弾対人判定用オブジェクト |
| 91 | 91 | |
| 92 | 92 | bool AddCollisionFlag; //!< 追加の当たり判定 |
| 93 | - bool FriendlyFire; //!< FF(同士討ち)有効化 | |
| 93 | + bool *FriendlyFire; //!< FF(同士討ち)有効化 | |
| 94 | 94 | |
| 95 | 95 | int Player_HumanID; //!< プレイヤーが操作する人オブジェクトのID |
| 96 | 96 |
| @@ -136,8 +136,8 @@ | ||
| 136 | 136 | void LoadPointData(); |
| 137 | 137 | void Recovery(); |
| 138 | 138 | void SetAddCollisionFlag(bool flag); |
| 139 | - bool GetFriendlyFireFlag(); | |
| 140 | - void SetFriendlyFireFlag(bool flag); | |
| 139 | + bool GetFriendlyFireFlag(int id); | |
| 140 | + void SetFriendlyFireFlag(int id, bool flag); | |
| 141 | 141 | int GetPlayerID(); |
| 142 | 142 | void SetPlayerID(int id); |
| 143 | 143 | human* GetHumanObject(int id); |
| @@ -60,7 +60,7 @@ | ||
| 60 | 60 | weapon_texture[i] = -1; |
| 61 | 61 | weapon_sound[i] = -1; |
| 62 | 62 | } |
| 63 | - for(int i=0; i<TOTAL_PARAMETERINFO_SMALLOBJECT+1; i++){ | |
| 63 | + for(int i=0; i<(TOTAL_PARAMETERINFO_SMALLOBJECT + MAX_ADDSMALLOBJECT); i++){ | |
| 64 | 64 | smallobject_model[i] = -1; |
| 65 | 65 | smallobject_texture[i] = -1; |
| 66 | 66 | smallobject_sound[i] = -1; |
| @@ -519,7 +519,7 @@ | ||
| 519 | 519 | //! @return 成功:0 失敗:1 |
| 520 | 520 | int ResourceManager::GetSmallObjectModelTexture(int id, int *model, int *texture) |
| 521 | 521 | { |
| 522 | - if( (id < 0)||((TOTAL_PARAMETERINFO_SMALLOBJECT+1 -1) < id ) ){ return 1; } | |
| 522 | + if( (id < 0)||((TOTAL_PARAMETERINFO_SMALLOBJECT + MAX_ADDSMALLOBJECT -1) < id ) ){ return 1; } | |
| 523 | 523 | |
| 524 | 524 | *model = smallobject_model[id]; |
| 525 | 525 | *texture = smallobject_texture[id]; |
| @@ -531,7 +531,7 @@ | ||
| 531 | 531 | { |
| 532 | 532 | if( d3dg == NULL ){ return; } |
| 533 | 533 | |
| 534 | - for(int i=0; i<TOTAL_PARAMETERINFO_SMALLOBJECT+1; i++){ | |
| 534 | + for(int i=0; i<(TOTAL_PARAMETERINFO_SMALLOBJECT + MAX_ADDSMALLOBJECT); i++){ | |
| 535 | 535 | d3dg->CleanupModel(smallobject_model[i]); |
| 536 | 536 | d3dg->CleanupTexture(smallobject_texture[i]); |
| 537 | 537 | smallobject_model[i] = -1; |
| @@ -580,7 +580,7 @@ | ||
| 580 | 580 | int ResourceManager::GetSmallObjectSound(int id) |
| 581 | 581 | { |
| 582 | 582 | if( SoundCtrl == NULL ){ return -1; } |
| 583 | - if( (id < 0)||((TOTAL_PARAMETERINFO_SMALLOBJECT+1 -1) < id ) ){ return -1; } | |
| 583 | + if( (id < 0)||((TOTAL_PARAMETERINFO_SMALLOBJECT + MAX_ADDSMALLOBJECT -1) < id ) ){ return -1; } | |
| 584 | 584 | return smallobject_sound[id]; |
| 585 | 585 | } |
| 586 | 586 |
| @@ -589,7 +589,7 @@ | ||
| 589 | 589 | { |
| 590 | 590 | if( SoundCtrl == NULL ){ return; } |
| 591 | 591 | |
| 592 | - for(int i=0; i<TOTAL_PARAMETERINFO_SMALLOBJECT+1; i++){ | |
| 592 | + for(int i=0; i<(TOTAL_PARAMETERINFO_SMALLOBJECT + MAX_ADDSMALLOBJECT); i++){ | |
| 593 | 593 | SoundCtrl->CleanupSound(smallobject_sound[i]); |
| 594 | 594 | smallobject_sound[i] = -1; |
| 595 | 595 | } |
| @@ -596,16 +596,18 @@ | ||
| 596 | 596 | } |
| 597 | 597 | |
| 598 | 598 | //! @brief 追加小物のモデル・テクスチャ・サウンドを取得 |
| 599 | +//! @param id データ番号(通常は 0 固定) | |
| 599 | 600 | //! @param modelpath モデルデータのパス |
| 600 | 601 | //! @param texturepath テクスチャデータのパス |
| 601 | 602 | //! @param soundpath サウンドデータのパス |
| 602 | 603 | //! @return 成功:0 失敗:1以上 |
| 603 | -int ResourceManager::LoadAddSmallObject(char *modelpath, char *texturepath, char *soundpath) | |
| 604 | +int ResourceManager::LoadAddSmallObject(int id, char *modelpath, char *texturepath, char *soundpath) | |
| 604 | 605 | { |
| 605 | 606 | if( d3dg == NULL ){ return 1; } |
| 606 | 607 | if( SoundCtrl == NULL ){ return 1; } |
| 608 | + if( (id < 0)||(MAX_ADDSMALLOBJECT-1 < id) ){ return -1; } | |
| 607 | 609 | |
| 608 | - int dataid = TOTAL_PARAMETERINFO_SMALLOBJECT+1 -1; | |
| 610 | + int dataid = TOTAL_PARAMETERINFO_SMALLOBJECT + id; | |
| 609 | 611 | int cnt = 0; |
| 610 | 612 | |
| 611 | 613 | smallobject_model[dataid] = d3dg->LoadModel(modelpath); |
| @@ -619,12 +621,14 @@ | ||
| 619 | 621 | } |
| 620 | 622 | |
| 621 | 623 | //! @brief 追加小物のモデル・テクスチャ・サウンドを解放 |
| 622 | -void ResourceManager::CleanupAddSmallObject() | |
| 624 | +//! @param id データ番号(通常は 0 固定) | |
| 625 | +void ResourceManager::CleanupAddSmallObject(int id) | |
| 623 | 626 | { |
| 624 | 627 | if( d3dg == NULL ){ return; } |
| 625 | 628 | if( SoundCtrl == NULL ){ return; } |
| 629 | + if( (id < 0)||(MAX_ADDSMALLOBJECT-1 < id) ){ return; } | |
| 626 | 630 | |
| 627 | - int dataid = TOTAL_PARAMETERINFO_SMALLOBJECT+1 -1; | |
| 631 | + int dataid = TOTAL_PARAMETERINFO_SMALLOBJECT + id; | |
| 628 | 632 | |
| 629 | 633 | d3dg->CleanupModel(smallobject_model[dataid]); |
| 630 | 634 | d3dg->CleanupTexture(smallobject_texture[dataid]); |
| @@ -63,9 +63,9 @@ | ||
| 63 | 63 | int weapon_texture[TOTAL_PARAMETERINFO_WEAPON]; //!< 武器のテクスチャ認識番号 |
| 64 | 64 | int weapon_sound[TOTAL_PARAMETERINFO_WEAPON]; //!< 武器のサウンド認識番号 |
| 65 | 65 | int weapon_reloadsound; //!< 武器のリロードサウンド認識番号 |
| 66 | - int smallobject_model[TOTAL_PARAMETERINFO_SMALLOBJECT+1]; //!< 小物のモデル認識番号 | |
| 67 | - int smallobject_texture[TOTAL_PARAMETERINFO_SMALLOBJECT+1]; //!< 小物のテクスチャ認識番号 | |
| 68 | - int smallobject_sound[TOTAL_PARAMETERINFO_SMALLOBJECT+1]; //!< 小物のサウンド認識番号 | |
| 66 | + int smallobject_model[TOTAL_PARAMETERINFO_SMALLOBJECT + MAX_ADDSMALLOBJECT]; //!< 小物のモデル認識番号 | |
| 67 | + int smallobject_texture[TOTAL_PARAMETERINFO_SMALLOBJECT + MAX_ADDSMALLOBJECT]; //!< 小物のテクスチャ認識番号 | |
| 68 | + int smallobject_sound[TOTAL_PARAMETERINFO_SMALLOBJECT + MAX_ADDSMALLOBJECT]; //!< 小物のサウンド認識番号 | |
| 69 | 69 | int bullet_model[TOTAL_PARAMETERINFO_BULLET]; //!< 弾のモデル |
| 70 | 70 | int bullet_texture[TOTAL_PARAMETERINFO_BULLET]; //!< 弾のテクスチャ |
| 71 | 71 |
| @@ -113,8 +113,8 @@ | ||
| 113 | 113 | int LoadSmallObjectSound(); |
| 114 | 114 | int GetSmallObjectSound(int id); |
| 115 | 115 | void CleanupSmallObjectSound(); |
| 116 | - int LoadAddSmallObject(char *modelpath, char *texturepath, char *soundpath); | |
| 117 | - void CleanupAddSmallObject(); | |
| 116 | + int LoadAddSmallObject(int id, char *modelpath, char *texturepath, char *soundpath); | |
| 117 | + void CleanupAddSmallObject(int id); | |
| 118 | 118 | int LoadBulletModelTexture(); |
| 119 | 119 | int GetBulletModelTexture(int id, int *model, int *texture); |
| 120 | 120 | void CleanupBulletModelTexture(); |