• R/O
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

X operations(XOPS)に非常に近いFPSゲームを制作・リメイクし、成果物をオープンソースとして公開することを目的としたプロジェクトです。


Commit MetaInfo

Revision235 (tree)
Time2020-02-25 18:26:05
Authorxops-mikan

Log Message

裏技で武器:NONEにしても装弾数:0にならないよう仕様改善、コメント(の記載漏れ)追加

Change Summary

Incremental Difference

--- trunk/ai.cpp (revision 234)
+++ trunk/ai.cpp (revision 235)
@@ -853,15 +853,24 @@
853853 {
854854 int selectweapon;
855855 class weapon *weapon[TOTAL_HAVEWEAPON];
856+ int lnbslist[TOTAL_HAVEWEAPON];
857+ int nbslist[TOTAL_HAVEWEAPON];
856858 int nbs = 0;
857859
858860 for(int i=0; i<TOTAL_HAVEWEAPON; i++){
859861 weapon[i] = NULL;
862+ lnbslist[i] = 0;
863+ nbslist[i] = 0;
860864 }
861865
862866 //武器の情報を取得
863- ctrlhuman->GetWeapon(&selectweapon, weapon);
867+ ctrlhuman->GetWeapon(&selectweapon, weapon, lnbslist, nbslist);
864868
869+ //武器を持っていないにも関わらず、装弾数があるなら切り替えない
870+ if( (weapon[selectweapon] == NULL)&&(nbslist[selectweapon] > 0) ){
871+ return 0;
872+ }
873+
865874 //武器を持っていれば、合計弾数を取得
866875 if( weapon[selectweapon] != NULL ){
867876 weapon[selectweapon]->GetParamData(NULL, NULL, &nbs);
@@ -987,7 +996,7 @@
987996 }
988997
989998 //武器の情報を取得
990- ctrlhuman->GetWeapon(&selectweapon, weapon);
999+ ctrlhuman->GetWeapon(&selectweapon, weapon, NULL, NULL);
9911000 if( weapon[selectweapon] == NULL ){ return 0; }
9921001 weapon[selectweapon]->GetParamData(&weaponid, &lnbs, &nbs);
9931002
@@ -1130,7 +1139,7 @@
11301139 }
11311140
11321141 //手榴弾を持っているか確認
1133- ctrlhuman->GetWeapon(&selectweapon, weapon);
1142+ ctrlhuman->GetWeapon(&selectweapon, weapon, NULL, NULL);
11341143 for(i=0; i<TOTAL_HAVEWEAPON; i++){
11351144 if( weapon[i] != NULL ){
11361145 weapon[i]->GetParamData(&weaponid, NULL, &nbs);
--- trunk/event.cpp (revision 234)
+++ trunk/event.cpp (revision 235)
@@ -79,7 +79,7 @@
7979 int weaponid;
8080
8181 //所有する武器オブジェクトを全て取得
82- in_human->GetWeapon(&selectweapon, out_weapon);
82+ in_human->GetWeapon(&selectweapon, out_weapon, NULL, NULL);
8383
8484 //全て調べる
8585 for(int i=0; i<TOTAL_HAVEWEAPON; i++){
--- trunk/gamemain.cpp (revision 234)
+++ trunk/gamemain.cpp (revision 235)
@@ -2307,7 +2307,7 @@
23072307 //プレイヤーの座標や武器を取得
23082308 myHuman->GetPosData(&x, &y, &z, &r);
23092309 myHuman->GetParamData(&param, &dataid, NULL, &team);
2310- myHuman->GetWeapon(&selectweapon, weapon);
2310+ myHuman->GetWeapon(&selectweapon, weapon, NULL, NULL);
23112311 for(int i=0; i<TOTAL_HAVEWEAPON; i++){
23122312 if( weapon[i] != NULL ){
23132313 weapon[i]->GetParamData(&weapon_paramid[i], NULL, NULL);
@@ -2723,10 +2723,14 @@
27232723 int selectweapon;
27242724 weapon *weapon[TOTAL_HAVEWEAPON];
27252725 int weapon_paramid[TOTAL_HAVEWEAPON];
2726+ int lnbslist[TOTAL_HAVEWEAPON];
2727+ int nbslist[TOTAL_HAVEWEAPON];
27262728 WeaponParameter weapon_paramdata;
27272729 for(int i=0; i<TOTAL_HAVEWEAPON; i++){
27282730 weapon[i] = NULL;
27292731 weapon_paramid[i] = 0;
2732+ lnbslist[i] = 0;
2733+ nbslist[i] = 0;
27302734 }
27312735 int lnbs = 0;
27322736 int nbs = 0;
@@ -2740,13 +2744,22 @@
27402744 int ErrorRange;
27412745
27422746 //各種設定やゲーム情報を取得
2743- myHuman->GetWeapon(&selectweapon, weapon);
2747+ myHuman->GetWeapon(&selectweapon, weapon, lnbslist, nbslist);
27442748 for(int i=0; i<TOTAL_HAVEWEAPON; i++){
2745- if( weapon[i] != NULL ){
2746- if( selectweapon == i ){
2749+ if( selectweapon == i ){
2750+ //メイン武器
2751+ //武器を持っているならその弾数、未所持ならば未所持時の弾数を取得
2752+ if( weapon[i] != NULL ){
27472753 weapon[i]->GetParamData(&weapon_paramid[i], &lnbs, &nbs);
27482754 }
27492755 else{
2756+ lnbs = lnbslist[i];
2757+ nbs = nbslist[i];
2758+ }
2759+ }
2760+ else{
2761+ //サブ武器 サブ武器は武器の種類のみ
2762+ if( weapon[i] != NULL ){
27502763 weapon[i]->GetParamData(&weapon_paramid[i], NULL, NULL);
27512764 }
27522765 }
@@ -4173,14 +4186,18 @@
41734186 //人が持っている武器もすべて無効にする
41744187 int dummy;
41754188 class weapon *weaponlist[TOTAL_HAVEWEAPON];
4176- thuman->GetWeapon(&dummy, weaponlist);
4189+ int lnbs[TOTAL_HAVEWEAPON];
4190+ int nbs[TOTAL_HAVEWEAPON];
4191+ thuman->GetWeapon(&dummy, weaponlist, NULL, NULL);
41774192 for(int i=0; i<TOTAL_HAVEWEAPON; i++){
41784193 if( weaponlist[i] != NULL ){
41794194 weaponlist[i]->SetEnableFlag(false);
41804195 weaponlist[i] = NULL;
41814196 }
4197+ lnbs[i] = 0;
4198+ nbs[i] = 0;
41824199 }
4183- thuman->SetWeapon(weaponlist);
4200+ thuman->SetWeapon(weaponlist, lnbs, nbs);
41844201
41854202 thuman->SetEnableFlag(false);
41864203 sprintf(str, "Delete human[%d].", id);
@@ -4198,16 +4215,18 @@
41984215 //人がその武器を持っているなら、関連付けを外す(捨てさせる)
41994216 int dummy;
42004217 class weapon *weaponlist[TOTAL_HAVEWEAPON];
4218+ int lnbs[TOTAL_HAVEWEAPON];
4219+ int nbs[TOTAL_HAVEWEAPON];
42014220 for(int i=0; i<MAX_HUMAN; i++){
42024221 human *thuman = ObjMgr.GetHumanObject(i);
42034222 if( thuman->GetEnableFlag() == true ){
4204- thuman->GetWeapon(&dummy, weaponlist);
4223+ thuman->GetWeapon(&dummy, weaponlist, lnbs, nbs);
42054224 for(int j=0; j<TOTAL_HAVEWEAPON; j++){
42064225 if( weaponlist[j] == tweapon ){
42074226 weaponlist[j] = NULL;
42084227 }
42094228 }
4210- thuman->SetWeapon(weaponlist);
4229+ thuman->SetWeapon(weaponlist, lnbs, nbs);
42114230 }
42124231 }
42134232
--- trunk/gamemain.h (revision 234)
+++ trunk/gamemain.h (revision 235)
@@ -179,7 +179,7 @@
179179 int Options_KeyConfigID; //!< オプション画面 No.2 キー設定ID
180180 int Options_KeyConfigCnt; //!< オプション画面 No.2 キー設定カウント(フレーム数)
181181 char *licenseinfo[OPTIONS_LICENSELINE]; //!< ライセンス文
182- char *licenseinfobuf;
182+ char *licenseinfobuf; //!< 表示するライセンス文を保持するバッファー
183183 #endif //ENABLE_MENUOPTIONS
184184
185185 void Render3D();
--- trunk/object.cpp (revision 234)
+++ trunk/object.cpp (revision 235)
@@ -182,6 +182,8 @@
182182
183183 for(int i=0; i<TOTAL_HAVEWEAPON; i++){
184184 weapon[i] = NULL;
185+ noweapon_bullets[i] = 0;
186+ noweapon_loadbullets[i] = 0;
185187 }
186188 selectweapon = 1;
187189 selectweaponcnt = 0;
@@ -251,6 +253,8 @@
251253
252254 for(int i=0; i<TOTAL_HAVEWEAPON; i++){
253255 weapon[i] = NULL;
256+ noweapon_bullets[i] = 0;
257+ noweapon_loadbullets[i] = 0;
254258 }
255259 selectweapon = 1;
256260 selectweaponcnt = 0;
@@ -366,8 +370,10 @@
366370
367371 //! @brief 武器を設定
368372 //! @param in_weapon[] 設定するweaponクラスのポインタ配列
373+//! @param nlnbs[] 武器未所持時の装弾数を設定するint配列
374+//! @param nnbs[] 武器未所持時の合計弾数を設定するint配列
369375 //! @warning 通常は PickupWeapon()関数 を使用すること
370-void human::SetWeapon(class weapon *in_weapon[])
376+void human::SetWeapon(class weapon *in_weapon[], int nlnbs[], int nnbs[])
371377 {
372378 for(int i=0; i<TOTAL_HAVEWEAPON; i++){
373379 if( in_weapon[i] == NULL ){
@@ -379,6 +385,8 @@
379385 weapon[i] = in_weapon[i];
380386 }
381387 }
388+ noweapon_loadbullets[i] = nlnbs[i];
389+ noweapon_bullets[i] = nnbs[i];
382390 }
383391 }
384392
@@ -403,6 +411,10 @@
403411 nowweapon->GetParamData(&id_param, NULL, NULL);
404412 MotionCtrl->PickupWeapon(id_param);
405413
414+ //未所持時の弾数情報は初期化
415+ noweapon_bullets[selectweapon] = 0;
416+ noweapon_loadbullets[selectweapon] = 0;
417+
406418 //切り替え完了のカウント
407419 selectweaponcnt = 10;
408420
@@ -480,11 +492,15 @@
480492 //! @brief 武器を取得
481493 //! @param out_selectweapon 選択されている武器 (0 〜 [TOTAL_HAVEWEAPON]-1)
482494 //! @param out_weapon 受け取るweaponクラスのポインタ配列 (配列数:TOTAL_HAVEWEAPON)
483-void human::GetWeapon(int *out_selectweapon, class weapon *out_weapon[])
495+//! @param nlnbs[] 武器未所持時の装弾数を受け取るint配列 (配列数:TOTAL_HAVEWEAPON、NULL可)
496+//! @param nnbs[] 武器未所持時の合計弾数を受け取るint配列 (配列数:TOTAL_HAVEWEAPON、NULL可)
497+void human::GetWeapon(int *out_selectweapon, class weapon *out_weapon[], int nlnbs[], int nnbs[])
484498 {
485499 *out_selectweapon = selectweapon;
486500 for(int i=0; i<TOTAL_HAVEWEAPON; i++){
487501 out_weapon[i] = weapon[i];
502+ if( nlnbs != NULL ){ nlnbs[i] = noweapon_loadbullets[i]; }
503+ if( nnbs != NULL ){ nnbs[i] = noweapon_bullets[i]; }
488504 }
489505 }
490506
@@ -676,6 +692,10 @@
676692 weapon[selectweapon]->Dropoff(pos_x, pos_y, pos_z, rotation_x, 1.63f);
677693 weapon[selectweapon] = NULL;
678694
695+ //未所持時の弾数情報は初期化
696+ noweapon_bullets[selectweapon] = 0;
697+ noweapon_loadbullets[selectweapon] = 0;
698+
679699 //スコープモードを解除
680700 SetDisableScope();
681701
@@ -1085,6 +1105,10 @@
10851105 if( weapon[i] != NULL ){
10861106 weapon[i]->Dropoff(pos_x, pos_y, pos_z, DegreeToRadian(10)*GetRand(36), 1.5f);
10871107 weapon[i] = NULL;
1108+
1109+ //未所持時の弾数情報は初期化
1110+ noweapon_bullets[i] = 0;
1111+ noweapon_loadbullets[i] = 0;
10881112 }
10891113 }
10901114
@@ -1289,6 +1313,10 @@
12891313 if( weapon[i] != NULL ){
12901314 weapon[i]->Dropoff(pos_x, pos_y, pos_z, DegreeToRadian(10)*GetRand(36), 1.5f);
12911315 weapon[i] = NULL;
1316+
1317+ //未所持時の弾数情報は初期化
1318+ noweapon_bullets[i] = 0;
1319+ noweapon_loadbullets[i] = 0;
12921320 }
12931321 }
12941322
--- trunk/object.h (revision 234)
+++ trunk/object.h (revision 235)
@@ -140,7 +140,9 @@
140140 float upmodel_size; //!< 上半身描画サイズ
141141 float armmodel_size; //!< 腕描画サイズ
142142 float legmodel_size; //!< 足描画サイズ
143- class weapon *weapon[TOTAL_HAVEWEAPON]; //!< 武器
143+ class weapon *weapon[TOTAL_HAVEWEAPON]; //!< 武器
144+ int noweapon_bullets[TOTAL_HAVEWEAPON]; //!< 武器未所持時の合計弾数
145+ int noweapon_loadbullets[TOTAL_HAVEWEAPON]; //!< 武器未所持時の装弾数
144146 int selectweapon; //!< 武器A/Bの選択
145147 int selectweaponcnt; //!< 武器の切り替えカウント
146148 int weaponshotcnt; //!< 武器の連射カウント
@@ -180,12 +182,12 @@
180182 virtual void SetTeamID(int id);
181183 virtual bool GetInvincibleFlag();
182184 virtual void SetInvincibleFlag(bool flag);
183- virtual void SetWeapon(class weapon *in_weapon[]);
185+ virtual void SetWeapon(class weapon *in_weapon[], int nlnbs[], int nnbs[]);
184186 virtual int PickupWeapon(class weapon *in_weapon);
185187 virtual void ChangeWeapon(int id = -1);
186188 virtual int GetChangeWeaponCnt();
187189 virtual int GetWeaponReloadCnt();
188- virtual void GetWeapon(int *out_selectweapon, class weapon *out_weapon[]);
190+ virtual void GetWeapon(int *out_selectweapon, class weapon *out_weapon[], int nlnbs[], int nnbs[]);
189191 virtual int GetMainWeaponTypeNO();
190192 virtual bool GetWeaponBlazingmode();
191193 virtual bool ShotWeapon(int *weapon_paramid, int *GunsightErrorRange);
--- trunk/objectmanager.cpp (revision 234)
+++ trunk/objectmanager.cpp (revision 235)
@@ -160,8 +160,12 @@
160160 int Humanindexid = -1;
161161 int Weaponindexid = -1;
162162 class weapon *Weapon[TOTAL_HAVEWEAPON];
163+ int lnbslist[TOTAL_HAVEWEAPON];
164+ int nbslist[TOTAL_HAVEWEAPON];
163165 for(int i=0; i<TOTAL_HAVEWEAPON; i++){
164166 Weapon[i] = NULL;
167+ lnbslist[i] = 0;
168+ nbslist[i] = 0;
165169 }
166170
167171 #ifndef ENABLE_BUG_HUMANWEAPON
@@ -238,7 +242,7 @@
238242 }
239243
240244 //人に持たせる
241- HumanIndex[Humanindexid].SetWeapon(Weapon);
245+ HumanIndex[Humanindexid].SetWeapon(Weapon, lnbslist, nbslist);
242246 }
243247
244248 //発砲フラグを初期化
@@ -270,8 +274,12 @@
270274 int Humanindexid = -1;
271275 int Weaponindexid = -1;
272276 class weapon *Weapon[TOTAL_HAVEWEAPON];
277+ int lnbslist[TOTAL_HAVEWEAPON];
278+ int nbslist[TOTAL_HAVEWEAPON];
273279 for(int i=0; i<TOTAL_HAVEWEAPON; i++){
274280 Weapon[i] = NULL;
281+ lnbslist[i] = 0;
282+ nbslist[i] = 0;
275283 }
276284
277285 #ifndef ENABLE_BUG_HUMANWEAPON
@@ -331,7 +339,7 @@
331339 }
332340
333341 //人に持たせる
334- HumanIndex[Humanindexid].SetWeapon(Weapon);
342+ HumanIndex[Humanindexid].SetWeapon(Weapon, lnbslist, nbslist);
335343 }
336344
337345 //ログ関係の処理
@@ -2143,7 +2151,7 @@
21432151 for(int i=0; i<TOTAL_HAVEWEAPON; i++){
21442152 weapon[i] = NULL;
21452153 }
2146- HumanIndex[human_id].GetWeapon(&selectweapon, weapon);
2154+ HumanIndex[human_id].GetWeapon(&selectweapon, weapon, NULL, NULL);
21472155
21482156 //何かしらの武器を持っていれば
21492157 if( weapon[selectweapon] != NULL ){
@@ -2174,13 +2182,17 @@
21742182
21752183 int selectweapon;
21762184 weapon *weapon[TOTAL_HAVEWEAPON];
2185+ int lnbslist[TOTAL_HAVEWEAPON];
2186+ int nbslist[TOTAL_HAVEWEAPON];
21772187 int lnbs, nbs;
21782188
21792189 //所持している武器を取得
21802190 for(int i=0; i<TOTAL_HAVEWEAPON; i++){
21812191 weapon[i] = NULL;
2192+ lnbslist[i] = 0;
2193+ nbslist[i] = 0;
21822194 }
2183- myHuman->GetWeapon(&selectweapon, weapon);
2195+ myHuman->GetWeapon(&selectweapon, weapon, lnbslist, nbslist);
21842196
21852197 //現在武器を所有しておらず、新たに持たせる武器もないなら
21862198 if( (weapon[selectweapon] == NULL)&&(new_weaponID == ID_WEAPON_NONE) ){
@@ -2193,30 +2205,43 @@
21932205 //新しい武器を配置
21942206 dataid = AddVisualWeaponIndex(new_weaponID, false);
21952207
2196- //武器が配置できれば、武器を持たせる
2208+ //武器が配置できれば
21972209 if( dataid != -1 ){
2210+ //武器設定を適用(主に弾数)
21982211 weapon[selectweapon] = &(WeaponIndex[dataid]);
2199- myHuman->SetWeapon(weapon);
2212+ weapon[selectweapon]->ResetWeaponParam(Resource, new_weaponID, lnbslist[selectweapon], nbslist[selectweapon]);
2213+
2214+ //未所持時の弾数情報は初期化
2215+ lnbslist[selectweapon] = 0;
2216+ nbslist[selectweapon] = 0;
2217+
2218+ //武器を持たせる
2219+ myHuman->SetWeapon(weapon, lnbslist, nbslist);
22002220 return true;
22012221 }
22022222 }
22032223 else{ //武器を所有していれば
2224+ //武器設定を取得(弾数設定を引き継ぐため)
2225+ weapon[selectweapon]->GetParamData(NULL, &lnbs, &nbs);
2226+
22042227 if( new_weaponID == ID_WEAPON_NONE ){ //武器を消すなら
2205- //一度武器を捨てた上で、その武器を削除
2206- if( myHuman->DumpWeapon() == true ){
2207- weapon[selectweapon]->SetEnableFlag(false);
2208- return true;
2209- }
2228+ //その武器は削除
2229+ weapon[selectweapon]->SetEnableFlag(false);
2230+
2231+ //武器を削除し、弾数を反映
2232+ weapon[selectweapon] = NULL;
2233+ lnbslist[selectweapon] = lnbs;
2234+ nbslist[selectweapon] = nbs;
2235+ myHuman->SetWeapon(weapon, lnbslist, nbslist);
2236+
2237+ //スコープモードを解除
2238+ myHuman->SetDisableScope();
22102239 }
22112240 else{ //武器を変更するなら
2212- //武器設定を取得(弾数設定を引き継ぐため)
2213- weapon[selectweapon]->GetParamData(NULL, &lnbs, &nbs);
2214-
22152241 //武器設定を適用
22162242 weapon[selectweapon]->ResetWeaponParam(Resource, new_weaponID, lnbs, nbs);
2217-
2218- return true;
22192243 }
2244+ return true;
22202245 }
22212246
22222247 return false;