• R/O
  • SSH
  • HTTPS

shaman: Commit


Commit MetaInfo

Révision73 (tree)
l'heure2013-06-22 20:21:32
Auteurshom5xg

Message de Log

メッセージ中に注視カメラが機能しない不具合を修正
コンテキストバンク
--新規実装
--GameCtrlを吸収

Change Summary

Modification

--- trunk/program/src/ContextBank/ContextBank.h (nonexistent)
+++ trunk/program/src/ContextBank/ContextBank.h (revision 73)
@@ -0,0 +1,26 @@
1+class CContextBank
2+{
3+public:
4+ struct ContextGameStatus_t
5+ {
6+ b32 bGameOver;
7+ };
8+ struct ContextEntity_t
9+ {
10+ vec4f vHaraPos;
11+ };
12+
13+public:
14+ CContextBank();
15+
16+ ContextGameStatus_t* TakeContextGameStatus();
17+ void ReturnContextGameStatus();
18+ ContextEntity_t* TakeContextEntity();
19+ void ReturnContextEntity();
20+
21+private:
22+ b32 m_bContextGameStatusLocked;
23+ ContextGameStatus_t m_ContextGameStatus;
24+ b32 m_bContextEntityLocked;
25+ ContextEntity_t m_ContextEntity;
26+};
\ No newline at end of file
--- trunk/program/src/ContextBank/ContextBank_inls.cpp (nonexistent)
+++ trunk/program/src/ContextBank/ContextBank_inls.cpp (revision 73)
@@ -0,0 +1,9 @@
1+/***************************************************************************/
2+/** @file ContextBank_inls.cpp
3+ @brief
4+ @author shom
5+****************************************************************************/
6+
7+#include "pch.h"
8+
9+#include "ContextBank.inl"
\ No newline at end of file
--- trunk/program/src/module/ai/Ai_Knight.cpp (revision 72)
+++ trunk/program/src/module/ai/Ai_Knight.cpp (revision 73)
@@ -12,7 +12,7 @@
1212
1313 #include "service/service_entity.h"
1414 #include "entity/automata/automata_shaman.h"
15-#include "service/Service_GameCtrl.h"
15+#include "ContextBank/ContextBank.h"
1616 #include "module/motion/ghost/motion_ghost.h"
1717
1818
@@ -38,7 +38,15 @@
3838
3939 void CModuleComponent_Ai_Knight::update_shift_ai()
4040 {
41- if( g_pService_GameCtrl->IsGameOver() )
41+ ct CContextBank::ContextGameStatus_t* pContext =
42+ g_pContextBank->TakeContextGameStatus();
43+
44+ cb32 bGameOver = pContext && pContext->bGameOver;
45+ USING_PTR (pContext) {
46+ g_pContextBank->ReturnContextGameStatus();
47+ }
48+
49+ if ( bGameOver )
4250 {
4351 set_state( eState_Wander );
4452 }
--- trunk/program/src/module/ai/ai_ghost.cpp (revision 72)
+++ trunk/program/src/module/ai/ai_ghost.cpp (revision 73)
@@ -12,7 +12,7 @@
1212
1313 #include "service/service_entity.h"
1414 #include "entity/automata/automata_shaman.h"
15-#include "service/Service_GameCtrl.h"
15+#include "ContextBank/ContextBank.h"
1616 #include "module/motion/ghost/motion_ghost.h"
1717
1818
@@ -38,7 +38,15 @@
3838
3939 void CModuleComponent_AiGhost::update_shift_ai()
4040 {
41- if( g_pService_GameCtrl->IsGameOver() )
41+ ct CContextBank::ContextGameStatus_t* pContext =
42+ g_pContextBank->TakeContextGameStatus();
43+
44+ cb32 bGameOver = pContext && pContext->bGameOver;
45+ USING_PTR (pContext) {
46+ g_pContextBank->ReturnContextGameStatus();
47+ }
48+
49+ if( bGameOver )
4250 {
4351 set_state( eState_Wander );
4452 }
--- trunk/program/src/module/component/ModuleComponent_Collision.cpp (revision 72)
+++ trunk/program/src/module/component/ModuleComponent_Collision.cpp (revision 73)
@@ -39,6 +39,7 @@
3939
4040 CModuleComponent_Collision::~CModuleComponent_Collision()
4141 {
42+ ASSERT(g_p_service_collision);
4243 #if 0
4344 VERIFY( g_p_service_collision->UnregisterCollision( m_uid ) );
4445 #else
@@ -54,7 +55,7 @@
5455 void CModuleComponent_Collision::GetPosLeftTop( vec2f& out_v2 ) const
5556 {
5657 vec2f v2Pos;
57- m_p_entity_loaded ->GetPos( v2Pos );
58+ m_p_entity_loaded->GetPos( v2Pos );
5859 out_v2 = mm::sub_v( v2Pos, mm::div_v( m_v2Size, 2.f ) );
5960 }
6061
--- trunk/program/src/camera/Camera_inls.cpp (nonexistent)
+++ trunk/program/src/camera/Camera_inls.cpp (revision 73)
@@ -0,0 +1,11 @@
1+/***************************************************************************/
2+/** @file Camera_inls.cpp
3+ @brief
4+ @author shom
5+****************************************************************************/
6+
7+#include "pch.h"
8+
9+#include "camera/Camera_Event.inl"
10+#include "camera/Camera_Fixed.inl"
11+#include "camera/Camera_Sticky.inl"
\ No newline at end of file
--- trunk/program/src/game.cpp (revision 72)
+++ trunk/program/src/game.cpp (revision 73)
@@ -10,21 +10,23 @@
1010
1111 #include "core/app.h"
1212
13-#include "service/service_input.h"
1413 #include "core/sound/Sound.h"
1514 #include "core/font/Font_Texture.h"
1615 #if !0
1716 #include "core/font/Font_Gdi.h"
1817 #endif
18+#include "ContextBank/ContextBank.h"
19+#include "mode/mode_manager.h"
20+
1921 #include "service/Service_Bgm.h"
2022 #include "service/Service_Camera.h"
21-#include "service/service_stage.h"
23+#include "service/service_collision.h"
2224 #include "service/service_entity.h"
23-#include "service/service_collision.h"
2425 #include "service/service_frontend.h"
26+#include "service/Service_GameCtrl.h"
27+#include "service/service_input.h"
28+#include "service/service_stage.h"
2529 #include "service/service_sequence.h"
26-#include "service/Service_GameCtrl.h"
27-#include "mode/mode_manager.h"
2830
2931 #include "core/debug/fps_counter/fps_counter.h"
3032
@@ -39,13 +41,21 @@
3941 void game::GameInit( HWND h_wnd, HINSTANCE h_inst )
4042 {
4143 ///--
44+ for (u32 i=0; ; ++i) {
4245 /**---------------------------------------------------------------------**/
43-#define GLOBAL_VARIABLES__PCH_mb( _class, _instance, _args ) \
44- _instance = new _class##( _args );
46+#define GLOBAL_VARIABLES__PCH_mb( _class, _instance, _args, _order_new, _order_del ) \
47+ if (_order_new == i) { \
48+ _instance = new _class##( _args ); \
49+ continue; \
50+ } else
4551
4652 GLOBAL_VARIABLES__PCH_list
4753 #undef GLOBAL_VARIABLES__PCH_mb
4854 /**---------------------------------------------------------------------**/
55+ {
56+ break;
57+ }
58+ }
4959 ///--
5060
5161 ///--
@@ -74,13 +84,21 @@
7484 ///--
7585
7686 ///--
87+ for (u32 i=0; ; ++i) {
7788 /**---------------------------------------------------------------------**/
78-#define GLOBAL_VARIABLES__PCH_mb( _1, _instance, _3 ) \
79- my_safe_del( _instance );
89+#define GLOBAL_VARIABLES__PCH_mb( _1, _instance, _3, _4, _order_del ) \
90+ if (_order_del == i) { \
91+ my_safe_del( _instance ); \
92+ continue; \
93+ } else
8094
8195 GLOBAL_VARIABLES__PCH_list
8296 #undef GLOBAL_VARIABLES__PCH_mb
8397 /**---------------------------------------------------------------------**/
98+ {
99+ break;
100+ }
101+ }
84102 ///--
85103 }
86104
@@ -96,6 +114,7 @@
96114 g_p_service_entity->UpdatePreCollisionDetect();
97115 g_p_service_collision->Update();
98116 g_p_service_entity->UpdatePostCollisionDetect();
117+ g_p_service_camera->Update();
99118 g_p_service_frontend->Update();
100119 g_p_service_entity->UpdatePreDraw();
101120
--- trunk/program/src/pch.cpp (revision 72)
+++ trunk/program/src/pch.cpp (revision 73)
@@ -7,7 +7,7 @@
77 #include "pch.h"
88
99 /**---------------------------------------------------------------------**/
10-#define GLOBAL_VARIABLES__PCH_mb( _class, _instance, _3 ) \
10+#define GLOBAL_VARIABLES__PCH_mb( _class, _instance, _3, _4, _5 ) \
1111 \
1212 _class* _instance;
1313
--- trunk/program/src/pch.h (revision 72)
+++ trunk/program/src/pch.h (revision 73)
@@ -45,20 +45,20 @@
4545
4646 /**=====================================================================**/
4747 #define GLOBAL_VARIABLES__PCH_list \
48-/*GLOBAL_VARIABLES__PCH_mb( _class, _instance, _args )*/ \
49-GLOBAL_VARIABLES__PCH_mb( cservice_input , g_p_service_input , h_inst ) \
50-GLOBAL_VARIABLES__PCH_mb( CSound , g_pSound , ) \
51-GLOBAL_VARIABLES__PCH_mb( CService_Bgm , g_pService_Bgm , ) \
52-GLOBAL_VARIABLES__PCH_mb( cmode_manager , g_p_mode_manager , ) \
53-GLOBAL_VARIABLES__PCH_mb( CFont_Texture , g_pFont , ) \
54-GLOBAL_VARIABLES__PCH_mb( CFont_Gdi , g_p_font_gdi , ) \
55-GLOBAL_VARIABLES__PCH_mb( CService_Camera , g_p_service_camera , ) \
56-GLOBAL_VARIABLES__PCH_mb( cservice_stage , g_p_service_stage , ) \
57-GLOBAL_VARIABLES__PCH_mb( cservice_entity , g_p_service_entity , ) \
58-GLOBAL_VARIABLES__PCH_mb( cservice_collision , g_p_service_collision , ) \
59-GLOBAL_VARIABLES__PCH_mb( cservice_frontend , g_p_service_frontend , ) \
60-GLOBAL_VARIABLES__PCH_mb( cservice_sequence , g_p_service_sequence , ) \
61-GLOBAL_VARIABLES__PCH_mb( CService_GameCtrl , g_pService_GameCtrl , ) \
48+/*GLOBAL_VARIABLES__PCH_mb( _class, _instance, _args, _order_new, _order_del )*/ \
49+GLOBAL_VARIABLES__PCH_mb( CFont_Texture , g_pFont , , 4 , 8 ) \
50+GLOBAL_VARIABLES__PCH_mb( CFont_Gdi , g_p_font_gdi , , 5 , 7 ) \
51+GLOBAL_VARIABLES__PCH_mb( CSound , g_pSound , , 1 , 11 ) \
52+GLOBAL_VARIABLES__PCH_mb( CContextBank , g_pContextBank , , 12 , 0 ) \
53+GLOBAL_VARIABLES__PCH_mb( cmode_manager , g_p_mode_manager , , 3 , 9 ) \
54+GLOBAL_VARIABLES__PCH_mb( CService_Bgm , g_pService_Bgm , , 2 , 10 ) \
55+GLOBAL_VARIABLES__PCH_mb( CService_Camera , g_p_service_camera , , 6 , 6 ) \
56+GLOBAL_VARIABLES__PCH_mb( cservice_collision , g_p_service_collision , , 8 , 4 ) \
57+GLOBAL_VARIABLES__PCH_mb( cservice_entity , g_p_service_entity , , 9 , 3 ) \
58+GLOBAL_VARIABLES__PCH_mb( cservice_frontend , g_p_service_frontend , , 10 , 2 ) \
59+GLOBAL_VARIABLES__PCH_mb( cservice_input , g_p_service_input , h_inst , 0 , 13 ) \
60+GLOBAL_VARIABLES__PCH_mb( cservice_sequence , g_p_service_sequence , , 11 , 1 ) \
61+GLOBAL_VARIABLES__PCH_mb( cservice_stage , g_p_service_stage , , 7 , 5 ) \
6262 /**=====================================================================**/
6363
6464 #else //if GL
@@ -66,15 +66,16 @@
6666 /**=====================================================================**/
6767 #define GLOBAL_VARIABLES__PCH_list \
6868 /*GLOBAL_VARIABLES__PCH_mb( _class, _instance, _args )*/ \
69-GLOBAL_VARIABLES__PCH_mb( cservice_input , g_p_service_input , ) \
70-GLOBAL_VARIABLES__PCH_mb( cservice_frontend , g_p_service_frontend , ) \
71-GLOBAL_VARIABLES__PCH_mb( cservice_sequence , g_p_service_sequence , ) \
69+GLOBAL_VARIABLES__PCH_mb( CContextBank , g_pContextBank , 3 , 0 ) \
70+GLOBAL_VARIABLES__PCH_mb( cservice_frontend , g_p_service_frontend , 2 , 1 ) \
71+GLOBAL_VARIABLES__PCH_mb( cservice_input , g_p_service_input , 0 , 3 ) \
72+GLOBAL_VARIABLES__PCH_mb( cservice_sequence , g_p_service_sequence , 1 , 2 ) \
7273 /**=====================================================================**/
7374
7475 #endif
7576
7677 /**---------------------------------------------------------------------**/
77-#define GLOBAL_VARIABLES__PCH_mb( _class, _instance, _3 ) \
78+#define GLOBAL_VARIABLES__PCH_mb( _class, _instance, _3, _4, _5 ) \
7879 class _class; \
7980 \
8081 extern _class* _instance;
--- trunk/program/src/service/Service_Camera.cpp (revision 72)
+++ trunk/program/src/service/Service_Camera.cpp (revision 73)
@@ -10,7 +10,9 @@
1010
1111 #include "core/window_def.h"
1212
13+#include "camera/Camera_Sticky.h"
1314
15+
1416 /***************************************************************************
1517 CService_Camera
1618 ****************************************************************************/
@@ -19,7 +21,8 @@
1921 :
2022 m_vPosLookAt( mm::zero_v4() ),
2123 m_fZoomRatio( 1.0f ),
22-m_bSetLensCover( FALSE )//
24+m_bSetLensCover( FALSE ),
25+m_pCameraObj( CREATE_SPTR(CCamera_Sticky) )
2326 {
2427 }
2528
@@ -48,3 +51,10 @@
4851 out_v2ScreenPos = mm::v3_to_v2( v3WorldPos );
4952 }
5053
54+void CService_Camera::Update()
55+{
56+ vec4f vPosLookAt;
57+ m_pCameraObj->Update(vPosLookAt);
58+ SetPosLookAt(vPosLookAt);
59+}
60+
--- trunk/program/src/service/Service_Camera.h (revision 72)
+++ trunk/program/src/service/Service_Camera.h (revision 73)
@@ -6,6 +6,7 @@
66
77 #pragma once
88
9+class CCamera_Sticky;
910
1011 class CService_Camera
1112 {
@@ -28,8 +29,13 @@
2829 void WorldToScreenPos( ct vec3f& in_v3WorldPos, vec2f& out_v2ScreenPos );
2930 ///--
3031
32+ ///--
33+ void Update();
34+ ///--
35+
3136 private:
32- vec4f m_vPosLookAt;
33- f32 m_fZoomRatio;
34- b32 m_bSetLensCover;
37+ vec4f m_vPosLookAt;
38+ f32 m_fZoomRatio;
39+ b32 m_bSetLensCover;
40+ SPTR_T(CCamera_Sticky) m_pCameraObj;
3541 };
--- trunk/program/src/service/service_input.cpp (revision 72)
+++ trunk/program/src/service/service_input.cpp (revision 73)
@@ -52,7 +52,7 @@
5252 /**---------------------------------------------------------------------**/
5353 #endif
5454
55-m_dummy(0)//,
55+m_uInputMask(0)//,
5656 {
5757 #ifdef DX
5858 if( FAILED( DirectInput8Create(
@@ -203,3 +203,13 @@
203203 return ( b_push && b_on );
204204 }
205205
206+void cservice_input::SetInputMask( eInputMask in_eMask )
207+{
208+ m_uInputMask |= in_eMask;
209+}
210+
211+void cservice_input::UnsetInputMask( eInputMask in_eMask )
212+{
213+ m_uInputMask &= ~in_eMask;
214+}
215+
--- trunk/program/src/service/service_input.h (revision 72)
+++ trunk/program/src/service/service_input.h (revision 73)
@@ -61,6 +61,42 @@
6161 b32 IsCatchingByMouse(
6262 const centity_base* const in_p_entity_loaded
6363 ) const;
64+
65+ enum eInputMask
66+ {
67+ //keyboard
68+ eInputMask_A = ( 1 << 0 ),
69+ eInputMask_W = ( 1 << 1 ),
70+ eInputMask_S = ( 1 << 2 ),
71+ eInputMask_D = ( 1 << 3 ),
72+ eInputMask_Left = ( 1 << 4 ),
73+ eInputMask_Up = ( 1 << 5 ),
74+ eInputMask_Down = ( 1 << 6 ),
75+ eInputMask_Right = ( 1 << 7 ),
76+
77+ //mouse
78+ eInputMask_MouseLeft = ( 1 << 8 ),
79+ eInputMask_MouseMiddle = ( 1 << 9 ),
80+ eInputMask_MouseRight = ( 1 << 10 ),
81+
82+ eNof_InputMask,
83+ eInputMask_Invalid,
84+
85+ //keyboard-special
86+ eInputMask_KeyboardCharacterAll =
87+ eInputMask_A | eInputMask_W | eInputMask_S | eInputMask_D,
88+ eInputMask_KeyboardDirAll =
89+ eInputMask_Left | eInputMask_Up | eInputMask_Down | eInputMask_Right,
90+ eInputMask_KeyboardAll =
91+ eInputMask_KeyboardCharacterAll | eInputMask_KeyboardDirAll,
92+
93+ //mouse-special
94+ eInputMask_MouseAll =
95+ eInputMask_MouseLeft,
96+
97+ };
98+ void SetInputMask( eInputMask in_eMask );
99+ void UnsetInputMask( eInputMask in_eMask );
64100
65101 private:
66102 #ifdef DX
@@ -75,6 +111,6 @@
75111 #undef INSTANCE__INPUT_MANAGER_mb
76112 /**---------------------------------------------------------------------**/
77113
78- b32 m_dummy;
114+ u32 m_uInputMask;
79115 };
80116
--- trunk/program/src/service/service_entity.cpp (revision 72)
+++ trunk/program/src/service/service_entity.cpp (revision 73)
@@ -18,7 +18,9 @@
1818 #include "entity/automata/automata_car.h"
1919 #include "entity/reactor/reactor_prop.h"
2020
21+#include "ContextBank/ContextBank.h"
2122
23+
2224 u32 UID_INVALID = (u32)-1;
2325
2426
@@ -60,13 +62,22 @@
6062
6163 void cservice_entity::UpdatePostCollisionDetect()
6264 {
63- foreach( entity_map_element_t& e, m_entity_map )
64- {
65- if( e.p_entity )
66- {
65+ foreach( entity_map_element_t& e, m_entity_map ) {
66+ USING_PTR( e.p_entity ) {
6767 e.p_entity->UpdatePostColli();
6868 }
6969 }
70+
71+ vec3f v3Pos;
72+ const cautomata_shaman *pHara = FindHara();
73+ USING_PTR( pHara ) {
74+ pHara->GetPos( v3Pos );
75+ }
76+ CContextBank::ContextEntity_t *pContext = g_pContextBank->TakeContextEntity();
77+ USING_PTR( pContext ) {
78+ pContext->vHaraPos = mm::v3_to_v4( v3Pos );
79+ g_pContextBank->ReturnContextEntity();
80+ }
7081 }
7182
7283 void cservice_entity::UpdatePreDraw()
--- trunk/program/src/entity/automata/automata_shaman.cpp (revision 72)
+++ trunk/program/src/entity/automata/automata_shaman.cpp (revision 73)
@@ -18,7 +18,7 @@
1818 #include "core/graphic/2d/image_board.h"
1919
2020 #include "service/service_entity.h"
21-#include "service/Service_GameCtrl.h"
21+#include "ContextBank/ContextBank.h"
2222
2323
2424 /***************************************************************************
@@ -64,7 +64,12 @@
6464 {
6565 m_e_state = eSTATE_DEAD;
6666
67- g_pService_GameCtrl->SetGameOver( TRUE );
67+ CContextBank::ContextGameStatus_t* pContext =
68+ g_pContextBank->TakeContextGameStatus();
69+ USING_PTR (pContext) {
70+ pContext->bGameOver = TRUE;
71+ g_pContextBank->ReturnContextGameStatus();
72+ }
6873
6974 #if 0
7075 g_p_service_entity->Destroy( GetUid() );
Afficher sur ancien navigateur de dépôt.