• 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

Revision36 (tree)
Time2015-02-13 02:54:42
Authorxops-mikan

Log Message

エフェクトのシステムを変更し、薬莢や血の描画を改善。

Change Summary

Incremental Difference

--- trunk/objectmanager.cpp (revision 35)
+++ trunk/objectmanager.cpp (revision 36)
@@ -466,6 +466,33 @@
466466 return -1;
467467 }
468468
469+//! @brief エフェクト追加
470+//! @param pos_x X座標
471+//! @param pos_y Y座標
472+//! @param pos_z Z座標
473+//! @param move_x X軸移動量
474+//! @param move_y Y軸移動量
475+//! @param move_z Z軸移動量
476+//! @param size 表示倍率
477+//! @param rotation 回転角度
478+//! @param count 表示フレーム数
479+//! @param texture テクスチャの認識番号
480+//! @param settype エフェクトの種類 (Effect_Type を組み合せる)
481+//! @return 成功:データ番号(0以上) 失敗:-1
482+int ObjectManager::AddEffect(float pos_x, float pos_y, float pos_z, float move_x, float move_y, float move_z, float size, float rotation, int count, int texture, int settype)
483+{
484+ for(int i=0; i<MAX_EFFECT; i++){
485+ if( EffectIndex[i].GetDrawFlag() == false ){
486+ EffectIndex[i].SetPosData(pos_x, pos_y, pos_z, 0.0f);
487+ EffectIndex[i].SetParamData(move_x, move_y, move_z, size, rotation, count, texture, settype, true);
488+ EffectIndex[i].SetDrawFlag(true);
489+ return i;
490+ }
491+ }
492+
493+ return -1;
494+}
495+
469496 //! @brief 出血させる
470497 //! @param x X座標
471498 //! @param y Y座標
@@ -473,22 +500,10 @@
473500 void ObjectManager::SetHumanBlood(float x, float y, float z)
474501 {
475502 if( GameConfig.GetBloodFlag() == true ){
476- for(int i=0; i<MAX_EFFECT; i++){
477- if( EffectIndex[i].GetDrawFlag() == false ){
478- EffectIndex[i].SetPosData(x+1.0f, y+1.0f, z+1.0f, 0.0f);
479- EffectIndex[i].SetParamData(10.0f, (float)M_PI/18*GetRand(18), (int)GAMEFPS * 1, Resource->GetEffectBloodTexture(), EFFECT_FALL, true);
480- EffectIndex[i].SetDrawFlag(true);
481- break;
482- }
503+ for(int i=0; i<2; i++){
504+ float rx = (float)M_PI/18*GetRand(36);
505+ AddEffect(x + cos(rx)*1.0f, y + (float)(GetRand(20)-10)/10, z + sin(rx)*1.0f, cos(rx)*0.5f, 0.5f, sin(rx)*0.5f, 10.0f, (float)M_PI/18*GetRand(18), (int)GAMEFPS * 1, Resource->GetEffectBloodTexture(), EFFECT_FALL);
483506 }
484- for(int i=0; i<MAX_EFFECT; i++){
485- if( EffectIndex[i].GetDrawFlag() == false ){
486- EffectIndex[i].SetPosData(x-1.0f, y-1.0f, z-1.0f, 0.0f);
487- EffectIndex[i].SetParamData(10.0f, (float)M_PI/18*GetRand(18), (int)GAMEFPS * 1, Resource->GetEffectBloodTexture(), EFFECT_FALL, true);
488- EffectIndex[i].SetDrawFlag(true);
489- break;
490- }
491- }
492507 }
493508 }
494509
@@ -775,14 +790,7 @@
775790 void ObjectManager::HitBulletMap(float x, float y, float z)
776791 {
777792 //エフェクト(煙)を表示
778- for(int i=0; i<MAX_EFFECT; i++){
779- if( EffectIndex[i].GetDrawFlag() == false ){
780- EffectIndex[i].SetPosData(x, y, z, 0.0f);
781- EffectIndex[i].SetParamData(5.0f, (float)M_PI/18*GetRand(18), (int)(GAMEFPS * 0.5f), Resource->GetEffectSmokeTexture(), EFFECT_DISAPPEAR | EFFECT_MAGNIFY, true);
782- EffectIndex[i].SetDrawFlag(true);
783- break;
784- }
785- }
793+ AddEffect(x, y, z, 0.0f, 0.05f, 0.0f, 5.0f, (float)M_PI/18*GetRand(18), (int)(GAMEFPS * 0.5f), Resource->GetEffectSmokeTexture(), EFFECT_DISAPPEAR | EFFECT_MAGNIFY);
786794
787795 //効果音を再生
788796 GameSound->HitMap(x, y, z);
@@ -844,14 +852,7 @@
844852 SmallObjectIndex[HitSmallObject_id].HitBullet(attacks);
845853
846854 //エフェクト(煙)を表示
847- for(int i=0; i<MAX_EFFECT; i++){
848- if( EffectIndex[i].GetDrawFlag() == false ){
849- EffectIndex[i].SetPosData(x, y, z, 0.0f);
850- EffectIndex[i].SetParamData(5.0f, (float)M_PI/18*GetRand(18), (int)(GAMEFPS * 0.5f), Resource->GetEffectSmokeTexture(), EFFECT_DISAPPEAR | EFFECT_MAGNIFY, true);
851- EffectIndex[i].SetDrawFlag(true);
852- break;
853- }
854- }
855+ AddEffect(x, y, z, 0.0f, 0.05f, 0.0f, 5.0f, (float)M_PI/18*GetRand(18), (int)(GAMEFPS * 0.5f), Resource->GetEffectSmokeTexture(), EFFECT_DISAPPEAR | EFFECT_MAGNIFY);
855856
856857 //効果音を再生
857858 int id;
@@ -996,49 +997,14 @@
996997 }
997998
998999 //エフェクト(フラッシュ)の表示
999- for(int i=0; i<MAX_EFFECT; i++){
1000- if( EffectIndex[i].GetDrawFlag() == false ){
1001- EffectIndex[i].SetPosData(gx, gy, gz, 0.0f);
1002- EffectIndex[i].SetParamData(30.0f, 0.0f, 2, Resource->GetEffectMflashTexture(), EFFECT_NORMAL, true);
1003- EffectIndex[i].SetDrawFlag(true);
1004- break;
1005- }
1006- }
1000+ AddEffect(gx, gy, gz, 0.0f, 0.0f, 0.0f, 30.0f, 0.0f, 2, Resource->GetEffectMflashTexture(), EFFECT_NORMAL);
10071001
10081002 //エフェクト(煙)の表示
10091003 float rnd = (float)M_PI/18*GetRand(18);
1010- for(int i=0; i<MAX_EFFECT; i++){
1011- if( EffectIndex[i].GetDrawFlag() == false ){
1012- EffectIndex[i].SetPosData(gx+1.0f, gy+1.0f, gz+1.0f, 0.0f);
1013- EffectIndex[i].SetParamData(10.0f, rnd, (int)GAMEFPS * 3, Resource->GetEffectSmokeTexture(), EFFECT_DISAPPEAR | EFFECT_MAGNIFY | EFFECT_ROTATION, true);
1014- EffectIndex[i].SetDrawFlag(true);
1015- break;
1016- }
1017- }
1018- for(int i=0; i<MAX_EFFECT; i++){
1019- if( EffectIndex[i].GetDrawFlag() == false ){
1020- EffectIndex[i].SetPosData(gx-1.0f, gy-1.0f, gz-1.0f, 0.0f);
1021- EffectIndex[i].SetParamData(10.0f, rnd*-1, (int)GAMEFPS * 3, Resource->GetEffectSmokeTexture(), EFFECT_DISAPPEAR | EFFECT_MAGNIFY | EFFECT_ROTATION, true);
1022- EffectIndex[i].SetDrawFlag(true);
1023- break;
1024- }
1025- }
1026- for(int i=0; i<MAX_EFFECT; i++){
1027- if( EffectIndex[i].GetDrawFlag() == false ){
1028- EffectIndex[i].SetPosData(gx-1.0f, gy-1.0f, gz+1.0f, 0.0f);
1029- EffectIndex[i].SetParamData(10.0f, rnd, (int)GAMEFPS * 3, Resource->GetEffectSmokeTexture(), EFFECT_DISAPPEAR | EFFECT_MAGNIFY | EFFECT_ROTATION, true);
1030- EffectIndex[i].SetDrawFlag(true);
1031- break;
1032- }
1033- }
1034- for(int i=0; i<MAX_EFFECT; i++){
1035- if( EffectIndex[i].GetDrawFlag() == false ){
1036- EffectIndex[i].SetPosData(gx+1.0f, gy+1.0f, gz-1.0f, 0.0f);
1037- EffectIndex[i].SetParamData(10.0f, rnd*-1, (int)GAMEFPS * 3, Resource->GetEffectSmokeTexture(), EFFECT_DISAPPEAR | EFFECT_MAGNIFY | EFFECT_ROTATION, true);
1038- EffectIndex[i].SetDrawFlag(true);
1039- break;
1040- }
1041- }
1004+ AddEffect(gx+1.0f, gy+1.0f, gz+1.0f, 0.0f, 0.05f, 0.0f, 10.0f, rnd, (int)GAMEFPS * 3, Resource->GetEffectSmokeTexture(), EFFECT_DISAPPEAR | EFFECT_MAGNIFY | EFFECT_ROTATION);
1005+ AddEffect(gx-1.0f, gy-1.0f, gz-1.0f, 0.0f, 0.05f, 0.0f, 10.0f, rnd*-1, (int)GAMEFPS * 3, Resource->GetEffectSmokeTexture(), EFFECT_DISAPPEAR | EFFECT_MAGNIFY | EFFECT_ROTATION);
1006+ AddEffect(gx-1.0f, gy-1.0f, gz+1.0f, 0.0f, 0.05f, 0.0f, 10.0f, rnd, (int)GAMEFPS * 3, Resource->GetEffectSmokeTexture(), EFFECT_DISAPPEAR | EFFECT_MAGNIFY | EFFECT_ROTATION);
1007+ AddEffect(gx+1.0f, gy+1.0f, gz-1.0f, 0.0f, 0.05f, 0.0f, 10.0f, rnd*-1, (int)GAMEFPS * 3, Resource->GetEffectSmokeTexture(), EFFECT_DISAPPEAR | EFFECT_MAGNIFY | EFFECT_ROTATION);
10421008
10431009 //効果音を再生
10441010 GameSound->GrenadeExplosion(gx, gy, gz);
@@ -1073,38 +1039,10 @@
10731039
10741040 //エフェクト(煙)の表示
10751041 float rnd = (float)M_PI/18*GetRand(18);
1076- for(int i=0; i<MAX_EFFECT; i++){
1077- if( EffectIndex[i].GetDrawFlag() == false ){
1078- EffectIndex[i].SetPosData(hx+1.0f, hy+1.0f, hz+1.0f, 0.0f);
1079- EffectIndex[i].SetParamData(10.0f, rnd, (int)GAMEFPS * 3, Resource->GetEffectSmokeTexture(), EFFECT_DISAPPEAR | EFFECT_MAGNIFY | EFFECT_ROTATION, true);
1080- EffectIndex[i].SetDrawFlag(true);
1081- break;
1082- }
1083- }
1084- for(int i=0; i<MAX_EFFECT; i++){
1085- if( EffectIndex[i].GetDrawFlag() == false ){
1086- EffectIndex[i].SetPosData(hx-1.0f, hy-1.0f, hz-1.0f, 0.0f);
1087- EffectIndex[i].SetParamData(10.0f, rnd*-1, (int)GAMEFPS * 3, Resource->GetEffectSmokeTexture(), EFFECT_DISAPPEAR | EFFECT_MAGNIFY | EFFECT_ROTATION, true);
1088- EffectIndex[i].SetDrawFlag(true);
1089- break;
1090- }
1091- }
1092- for(int i=0; i<MAX_EFFECT; i++){
1093- if( EffectIndex[i].GetDrawFlag() == false ){
1094- EffectIndex[i].SetPosData(hx-1.0f, hy-1.0f, hz+1.0f, 0.0f);
1095- EffectIndex[i].SetParamData(10.0f, rnd, (int)GAMEFPS * 3, Resource->GetEffectSmokeTexture(), EFFECT_DISAPPEAR | EFFECT_MAGNIFY | EFFECT_ROTATION, true);
1096- EffectIndex[i].SetDrawFlag(true);
1097- break;
1098- }
1099- }
1100- for(int i=0; i<MAX_EFFECT; i++){
1101- if( EffectIndex[i].GetDrawFlag() == false ){
1102- EffectIndex[i].SetPosData(hx+1.0f, hy+1.0f, hz-1.0f, 0.0f);
1103- EffectIndex[i].SetParamData(10.0f, rnd*-1, (int)GAMEFPS * 3, Resource->GetEffectSmokeTexture(), EFFECT_DISAPPEAR | EFFECT_MAGNIFY | EFFECT_ROTATION, true);
1104- EffectIndex[i].SetDrawFlag(true);
1105- break;
1106- }
1107- }
1042+ AddEffect(hx+1.0f, hy+1.0f, hz+1.0f, 0.0f, 0.05f, 0.0f, 10.0f, rnd, (int)GAMEFPS * 3, Resource->GetEffectSmokeTexture(), EFFECT_DISAPPEAR | EFFECT_MAGNIFY | EFFECT_ROTATION);
1043+ AddEffect(hx-1.0f, hy-1.0f, hz-1.0f, 0.0f, 0.05f, 0.0f, 10.0f, rnd*-1, (int)GAMEFPS * 3, Resource->GetEffectSmokeTexture(), EFFECT_DISAPPEAR | EFFECT_MAGNIFY | EFFECT_ROTATION);
1044+ AddEffect(hx-1.0f, hy-1.0f, hz+1.0f, 0.0f, 0.05f, 0.0f, 10.0f, rnd, (int)GAMEFPS * 3, Resource->GetEffectSmokeTexture(), EFFECT_DISAPPEAR | EFFECT_MAGNIFY | EFFECT_ROTATION);
1045+ AddEffect(hx+1.0f, hy+1.0f, hz-1.0f, 0.0f, 0.05f, 0.0f, 10.0f, rnd*-1, (int)GAMEFPS * 3, Resource->GetEffectSmokeTexture(), EFFECT_DISAPPEAR | EFFECT_MAGNIFY | EFFECT_ROTATION);
11081046 }
11091047 }
11101048
@@ -1602,6 +1540,8 @@
16021540 int weapon_paramid;
16031541 WeaponParameter ParamData;
16041542 float x, y, z;
1543+ float flashsize, smokesize, yakkyousize;
1544+ float rx, mx, my, mz;
16051545
16061546 //人の座標と角度を取得
16071547 HumanIndex[humanid].GetPosData(&pos_x, &pos_y, &pos_z, NULL);
@@ -1612,13 +1552,19 @@
16121552 if( GameParamInfo->GetWeapon(weapon_paramid, &ParamData) != 0 ){ return; }
16131553
16141554 //マズルフラッシュと煙のサイズを決定
1615- float flashsize = 0.06f * ParamData.attacks;
1616- float smokesize = flashsize;
1617- float yakkyousize = 0.02f * ParamData.attacks;
1555+ flashsize = 0.06f * ParamData.attacks;
1556+ smokesize = flashsize;
1557+ yakkyousize = 0.01f * ParamData.attacks;
16181558 if( ParamData.silencer == true ){
16191559 flashsize /= 2;
16201560 }
16211561
1562+ //薬莢の移動量を決定
1563+ rx = rotation_x*-1 + (float)M_PI/2;
1564+ mx = cos(rx - (float)M_PI/2) * ParamData.yakkyou_sx /10;
1565+ my = (ParamData.yakkyou_sy + (GetRand(3)-1)) /10;
1566+ mz = sin(rx - (float)M_PI/2) * ParamData.yakkyou_sx /10;
1567+
16221568 //行列でエフェクト座標を計算
16231569 d3dg->SetWorldTransformHumanWeapon(pos_x, pos_y + 16.0f, pos_z, ParamData.flashx/10, ParamData.flashy/10, ParamData.flashz/10, rotation_x, armrotation_y*-1, 1.0f);
16241570 d3dg->GetWorldTransformPos(&x, &y, &z);
@@ -1625,15 +1571,7 @@
16251571 d3dg->ResetWorldTransform();
16261572
16271573 //マズルフラッシュ描画
1628- for(int i=0; i<MAX_EFFECT; i++){
1629- if( EffectIndex[i].GetDrawFlag() == false ){
1630- //エフェクト設定
1631- EffectIndex[i].SetPosData(x, y, z, 0.0f);
1632- EffectIndex[i].SetParamData(flashsize, (float)M_PI/18*GetRand(18), 1, Resource->GetEffectMflashTexture(), EFFECT_NORMAL, true);
1633- EffectIndex[i].SetDrawFlag(true);
1634- break;
1635- }
1636- }
1574+ AddEffect(x, y, z, 0.0f, 0.0f, 0.0f, flashsize, (float)M_PI/18*GetRand(18), 1, Resource->GetEffectMflashTexture(), EFFECT_NORMAL);
16371575
16381576 //行列でエフェクト座標を計算
16391577 d3dg->SetWorldTransformHumanWeapon(pos_x, pos_y + 16.0f, pos_z, ParamData.flashx/10, ParamData.flashy/10, ParamData.flashz/10 - 0.1f, rotation_x, armrotation_y*-1, 1.0f);
@@ -1641,15 +1579,7 @@
16411579 d3dg->ResetWorldTransform();
16421580
16431581 //エフェクト(煙)の表示
1644- for(int i=0; i<MAX_EFFECT; i++){
1645- if( EffectIndex[i].GetDrawFlag() == false ){
1646- //エフェクト設定
1647- EffectIndex[i].SetPosData(x, y, z, 0.0f);
1648- EffectIndex[i].SetParamData(smokesize, (float)M_PI/18*GetRand(18), (int)(GAMEFPS/3), Resource->GetEffectSmokeTexture(), EFFECT_DISAPPEAR | EFFECT_MAGNIFY | EFFECT_ROTATION, true);
1649- EffectIndex[i].SetDrawFlag(true);
1650- break;
1651- }
1652- }
1582+ AddEffect(x, y, z, 0.0f, 0.05f, 0.0f, smokesize, (float)M_PI/18*GetRand(18), (int)(GAMEFPS/3), Resource->GetEffectSmokeTexture(), EFFECT_DISAPPEAR | EFFECT_MAGNIFY | EFFECT_ROTATION);
16531583
16541584 //行列でエフェクト座標を計算
16551585 d3dg->SetWorldTransformHumanWeapon(pos_x, pos_y + 16.0f, pos_z, ParamData.yakkyou_px/10, ParamData.yakkyou_py/10, ParamData.yakkyou_pz/10, rotation_x, armrotation_y*-1, 1.0f);
@@ -1657,15 +1587,7 @@
16571587 d3dg->ResetWorldTransform();
16581588
16591589 //薬莢描画
1660- for(int i=0; i<MAX_EFFECT; i++){
1661- if( EffectIndex[i].GetDrawFlag() == false ){
1662- //エフェクト設定
1663- EffectIndex[i].SetPosData(x, y, z, 0.0f);
1664- EffectIndex[i].SetParamData(yakkyousize, (float)M_PI/18*GetRand(18), (int)(GAMEFPS/2), Resource->GetEffectYakkyouTexture(), EFFECT_ROTATION | EFFECT_FALL, true);
1665- EffectIndex[i].SetDrawFlag(true);
1666- break;
1667- }
1668- }
1590+ AddEffect(x, y, z, mx, my, mz, yakkyousize, (float)M_PI/18*GetRand(18), (int)(GAMEFPS/2), Resource->GetEffectYakkyouTexture(), EFFECT_ROTATION | EFFECT_FALL);
16691591 }
16701592
16711593 //! @brief 武器をリロード
--- trunk/object.cpp (revision 35)
+++ trunk/object.cpp (revision 36)
@@ -2509,6 +2509,9 @@
25092509 {}
25102510
25112511 //! @brief 設定値を設定
2512+//! @param in_move_x X軸移動量
2513+//! @param in_move_y Y軸移動量
2514+//! @param in_move_z Z軸移動量
25122515 //! @param size 表示倍率
25132516 //! @param rotation 回転角度
25142517 //! @param count 表示フレーム数
@@ -2515,8 +2518,11 @@
25152518 //! @param texture テクスチャの認識番号
25162519 //! @param settype エフェクトの種類 (Effect_Type を組み合せる)
25172520 //! @param init オブジェクトを初期化
2518-void effect::SetParamData(float size, float rotation, int count, int texture, int settype, bool init)
2521+void effect::SetParamData(float in_move_x, float in_move_y, float in_move_z, float size, float rotation, int count, int texture, int settype, bool init)
25192522 {
2523+ move_x = in_move_x;
2524+ move_y = in_move_y;
2525+ move_z = in_move_z;
25202526 model_size = size;
25212527 rotation_texture = rotation;
25222528 cnt = count;
@@ -2550,6 +2556,11 @@
25502556 camera_rx = in_camera_rx;
25512557 camera_ry = in_camera_ry;
25522558
2559+ //座標移動
2560+ pos_x += move_x;
2561+ pos_y += move_y;
2562+ pos_z += move_z;
2563+
25532564 //特殊処理を実行
25542565 if( type & EFFECT_DISAPPEAR ){ //消す
25552566 alpha -= 1.0f/setcnt;
@@ -2566,11 +2577,8 @@
25662577 }
25672578 }
25682579 if( type & EFFECT_FALL ){ //落下
2569- pos_y -= 1.0f;
2580+ move_y = (move_y - 0.17f) * 0.98f;
25702581 }
2571- else{
2572- pos_y += 0.05f;
2573- }
25742582
25752583 //カウントを 1 引く
25762584 cnt -= 1;
--- trunk/objectmanager.h (revision 35)
+++ trunk/objectmanager.h (revision 36)
@@ -111,6 +111,7 @@
111111 int AddHumanIndex(float px, float py, float pz, float rx, int CharacterID, int TeamID, int WeaponID[]);
112112 int AddVisualWeaponIndex(int WeaponID, bool loadbullet);
113113 int AddSmallObjectIndex(float px, float py, float pz, float rx, int paramID, bool MapColl);
114+ int AddEffect(float pos_x, float pos_y, float pos_z, float move_x, float move_y, float move_z, float size, float rotation, int count, int texture, int settype);
114115 void LoadPointData();
115116 int GetPlayerID();
116117 void SetPlayerID(int id);
--- trunk/object.h (revision 35)
+++ trunk/object.h (revision 36)
@@ -318,6 +318,9 @@
318318 int type; //!< 種類
319319 float camera_rx; //!< カメラ角度
320320 float camera_ry; //!< カメラ角度
321+ float move_x; //!< X軸移動量
322+ float move_y; //!< Y軸移動量
323+ float move_z; //!< Z軸移動量
321324 float rotation_texture; //!< 回転角度
322325 float alpha; //!< 透明度
323326 int cnt; //!< カウント
@@ -326,7 +329,7 @@
326329 public:
327330 effect(float x = 0.0f, float y = 0.0f, float z = 0.0f, float size = 1.0f, float rotation = 0.0f, int count = 0, int texture = 0, int settype = 0);
328331 ~effect();
329- virtual void SetParamData(float size, float rotation, int count, int texture, int settype, bool init);
332+ virtual void SetParamData(float in_move_x, float in_move_y, float in_move_z, float size, float rotation, int count, int texture, int settype, bool init);
330333 virtual int RunFrame(float in_camera_rx, float in_camera_ry);
331334 virtual void Render(class D3DGraphics *d3dg);
332335 };