メッセージ中に注視カメラが機能しない不具合を修正
コンテキストバンク
--新規実装
--GameCtrlを吸収
@@ -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 |
@@ -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 |
@@ -12,7 +12,7 @@ | ||
12 | 12 | |
13 | 13 | #include "service/service_entity.h" |
14 | 14 | #include "entity/automata/automata_shaman.h" |
15 | -#include "service/Service_GameCtrl.h" | |
15 | +#include "ContextBank/ContextBank.h" | |
16 | 16 | #include "module/motion/ghost/motion_ghost.h" |
17 | 17 | |
18 | 18 |
@@ -38,7 +38,15 @@ | ||
38 | 38 | |
39 | 39 | void CModuleComponent_Ai_Knight::update_shift_ai() |
40 | 40 | { |
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 ) | |
42 | 50 | { |
43 | 51 | set_state( eState_Wander ); |
44 | 52 | } |
@@ -12,7 +12,7 @@ | ||
12 | 12 | |
13 | 13 | #include "service/service_entity.h" |
14 | 14 | #include "entity/automata/automata_shaman.h" |
15 | -#include "service/Service_GameCtrl.h" | |
15 | +#include "ContextBank/ContextBank.h" | |
16 | 16 | #include "module/motion/ghost/motion_ghost.h" |
17 | 17 | |
18 | 18 |
@@ -38,7 +38,15 @@ | ||
38 | 38 | |
39 | 39 | void CModuleComponent_AiGhost::update_shift_ai() |
40 | 40 | { |
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 ) | |
42 | 50 | { |
43 | 51 | set_state( eState_Wander ); |
44 | 52 | } |
@@ -39,6 +39,7 @@ | ||
39 | 39 | |
40 | 40 | CModuleComponent_Collision::~CModuleComponent_Collision() |
41 | 41 | { |
42 | + ASSERT(g_p_service_collision); | |
42 | 43 | #if 0 |
43 | 44 | VERIFY( g_p_service_collision->UnregisterCollision( m_uid ) ); |
44 | 45 | #else |
@@ -54,7 +55,7 @@ | ||
54 | 55 | void CModuleComponent_Collision::GetPosLeftTop( vec2f& out_v2 ) const |
55 | 56 | { |
56 | 57 | vec2f v2Pos; |
57 | - m_p_entity_loaded ->GetPos( v2Pos ); | |
58 | + m_p_entity_loaded->GetPos( v2Pos ); | |
58 | 59 | out_v2 = mm::sub_v( v2Pos, mm::div_v( m_v2Size, 2.f ) ); |
59 | 60 | } |
60 | 61 |
@@ -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 |
@@ -10,21 +10,23 @@ | ||
10 | 10 | |
11 | 11 | #include "core/app.h" |
12 | 12 | |
13 | -#include "service/service_input.h" | |
14 | 13 | #include "core/sound/Sound.h" |
15 | 14 | #include "core/font/Font_Texture.h" |
16 | 15 | #if !0 |
17 | 16 | #include "core/font/Font_Gdi.h" |
18 | 17 | #endif |
18 | +#include "ContextBank/ContextBank.h" | |
19 | +#include "mode/mode_manager.h" | |
20 | + | |
19 | 21 | #include "service/Service_Bgm.h" |
20 | 22 | #include "service/Service_Camera.h" |
21 | -#include "service/service_stage.h" | |
23 | +#include "service/service_collision.h" | |
22 | 24 | #include "service/service_entity.h" |
23 | -#include "service/service_collision.h" | |
24 | 25 | #include "service/service_frontend.h" |
26 | +#include "service/Service_GameCtrl.h" | |
27 | +#include "service/service_input.h" | |
28 | +#include "service/service_stage.h" | |
25 | 29 | #include "service/service_sequence.h" |
26 | -#include "service/Service_GameCtrl.h" | |
27 | -#include "mode/mode_manager.h" | |
28 | 30 | |
29 | 31 | #include "core/debug/fps_counter/fps_counter.h" |
30 | 32 |
@@ -39,13 +41,21 @@ | ||
39 | 41 | void game::GameInit( HWND h_wnd, HINSTANCE h_inst ) |
40 | 42 | { |
41 | 43 | ///-- |
44 | + for (u32 i=0; ; ++i) { | |
42 | 45 | /**---------------------------------------------------------------------**/ |
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 | |
45 | 51 | |
46 | 52 | GLOBAL_VARIABLES__PCH_list |
47 | 53 | #undef GLOBAL_VARIABLES__PCH_mb |
48 | 54 | /**---------------------------------------------------------------------**/ |
55 | + { | |
56 | + break; | |
57 | + } | |
58 | + } | |
49 | 59 | ///-- |
50 | 60 | |
51 | 61 | ///-- |
@@ -74,13 +84,21 @@ | ||
74 | 84 | ///-- |
75 | 85 | |
76 | 86 | ///-- |
87 | + for (u32 i=0; ; ++i) { | |
77 | 88 | /**---------------------------------------------------------------------**/ |
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 | |
80 | 94 | |
81 | 95 | GLOBAL_VARIABLES__PCH_list |
82 | 96 | #undef GLOBAL_VARIABLES__PCH_mb |
83 | 97 | /**---------------------------------------------------------------------**/ |
98 | + { | |
99 | + break; | |
100 | + } | |
101 | + } | |
84 | 102 | ///-- |
85 | 103 | } |
86 | 104 |
@@ -96,6 +114,7 @@ | ||
96 | 114 | g_p_service_entity->UpdatePreCollisionDetect(); |
97 | 115 | g_p_service_collision->Update(); |
98 | 116 | g_p_service_entity->UpdatePostCollisionDetect(); |
117 | + g_p_service_camera->Update(); | |
99 | 118 | g_p_service_frontend->Update(); |
100 | 119 | g_p_service_entity->UpdatePreDraw(); |
101 | 120 |
@@ -7,7 +7,7 @@ | ||
7 | 7 | #include "pch.h" |
8 | 8 | |
9 | 9 | /**---------------------------------------------------------------------**/ |
10 | -#define GLOBAL_VARIABLES__PCH_mb( _class, _instance, _3 ) \ | |
10 | +#define GLOBAL_VARIABLES__PCH_mb( _class, _instance, _3, _4, _5 ) \ | |
11 | 11 | \ |
12 | 12 | _class* _instance; |
13 | 13 |
@@ -45,20 +45,20 @@ | ||
45 | 45 | |
46 | 46 | /**=====================================================================**/ |
47 | 47 | #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 ) \ | |
62 | 62 | /**=====================================================================**/ |
63 | 63 | |
64 | 64 | #else //if GL |
@@ -66,15 +66,16 @@ | ||
66 | 66 | /**=====================================================================**/ |
67 | 67 | #define GLOBAL_VARIABLES__PCH_list \ |
68 | 68 | /*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 ) \ | |
72 | 73 | /**=====================================================================**/ |
73 | 74 | |
74 | 75 | #endif |
75 | 76 | |
76 | 77 | /**---------------------------------------------------------------------**/ |
77 | -#define GLOBAL_VARIABLES__PCH_mb( _class, _instance, _3 ) \ | |
78 | +#define GLOBAL_VARIABLES__PCH_mb( _class, _instance, _3, _4, _5 ) \ | |
78 | 79 | class _class; \ |
79 | 80 | \ |
80 | 81 | extern _class* _instance; |
@@ -10,7 +10,9 @@ | ||
10 | 10 | |
11 | 11 | #include "core/window_def.h" |
12 | 12 | |
13 | +#include "camera/Camera_Sticky.h" | |
13 | 14 | |
15 | + | |
14 | 16 | /*************************************************************************** |
15 | 17 | CService_Camera |
16 | 18 | ****************************************************************************/ |
@@ -19,7 +21,8 @@ | ||
19 | 21 | : |
20 | 22 | m_vPosLookAt( mm::zero_v4() ), |
21 | 23 | m_fZoomRatio( 1.0f ), |
22 | -m_bSetLensCover( FALSE )// | |
24 | +m_bSetLensCover( FALSE ), | |
25 | +m_pCameraObj( CREATE_SPTR(CCamera_Sticky) ) | |
23 | 26 | { |
24 | 27 | } |
25 | 28 |
@@ -48,3 +51,10 @@ | ||
48 | 51 | out_v2ScreenPos = mm::v3_to_v2( v3WorldPos ); |
49 | 52 | } |
50 | 53 | |
54 | +void CService_Camera::Update() | |
55 | +{ | |
56 | + vec4f vPosLookAt; | |
57 | + m_pCameraObj->Update(vPosLookAt); | |
58 | + SetPosLookAt(vPosLookAt); | |
59 | +} | |
60 | + |
@@ -6,6 +6,7 @@ | ||
6 | 6 | |
7 | 7 | #pragma once |
8 | 8 | |
9 | +class CCamera_Sticky; | |
9 | 10 | |
10 | 11 | class CService_Camera |
11 | 12 | { |
@@ -28,8 +29,13 @@ | ||
28 | 29 | void WorldToScreenPos( ct vec3f& in_v3WorldPos, vec2f& out_v2ScreenPos ); |
29 | 30 | ///-- |
30 | 31 | |
32 | + ///-- | |
33 | + void Update(); | |
34 | + ///-- | |
35 | + | |
31 | 36 | 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; | |
35 | 41 | }; |
@@ -52,7 +52,7 @@ | ||
52 | 52 | /**---------------------------------------------------------------------**/ |
53 | 53 | #endif |
54 | 54 | |
55 | -m_dummy(0)//, | |
55 | +m_uInputMask(0)//, | |
56 | 56 | { |
57 | 57 | #ifdef DX |
58 | 58 | if( FAILED( DirectInput8Create( |
@@ -203,3 +203,13 @@ | ||
203 | 203 | return ( b_push && b_on ); |
204 | 204 | } |
205 | 205 | |
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 | + |
@@ -61,6 +61,42 @@ | ||
61 | 61 | b32 IsCatchingByMouse( |
62 | 62 | const centity_base* const in_p_entity_loaded |
63 | 63 | ) 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 ); | |
64 | 100 | |
65 | 101 | private: |
66 | 102 | #ifdef DX |
@@ -75,6 +111,6 @@ | ||
75 | 111 | #undef INSTANCE__INPUT_MANAGER_mb |
76 | 112 | /**---------------------------------------------------------------------**/ |
77 | 113 | |
78 | - b32 m_dummy; | |
114 | + u32 m_uInputMask; | |
79 | 115 | }; |
80 | 116 |
@@ -18,7 +18,9 @@ | ||
18 | 18 | #include "entity/automata/automata_car.h" |
19 | 19 | #include "entity/reactor/reactor_prop.h" |
20 | 20 | |
21 | +#include "ContextBank/ContextBank.h" | |
21 | 22 | |
23 | + | |
22 | 24 | u32 UID_INVALID = (u32)-1; |
23 | 25 | |
24 | 26 |
@@ -60,13 +62,22 @@ | ||
60 | 62 | |
61 | 63 | void cservice_entity::UpdatePostCollisionDetect() |
62 | 64 | { |
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 ) { | |
67 | 67 | e.p_entity->UpdatePostColli(); |
68 | 68 | } |
69 | 69 | } |
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 | + } | |
70 | 81 | } |
71 | 82 | |
72 | 83 | void cservice_entity::UpdatePreDraw() |
@@ -18,7 +18,7 @@ | ||
18 | 18 | #include "core/graphic/2d/image_board.h" |
19 | 19 | |
20 | 20 | #include "service/service_entity.h" |
21 | -#include "service/Service_GameCtrl.h" | |
21 | +#include "ContextBank/ContextBank.h" | |
22 | 22 | |
23 | 23 | |
24 | 24 | /*************************************************************************** |
@@ -64,7 +64,12 @@ | ||
64 | 64 | { |
65 | 65 | m_e_state = eSTATE_DEAD; |
66 | 66 | |
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 | + } | |
68 | 73 | |
69 | 74 | #if 0 |
70 | 75 | g_p_service_entity->Destroy( GetUid() ); |