Skip to content

Commit ed510c6

Browse files
committed
Reformat: xrGame
1 parent 6cf7972 commit ed510c6

File tree

2,575 files changed

+252613
-267866
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,575 files changed

+252613
-267866
lines changed

src/xrGame/AI_PhraseDialogManager.cpp

Lines changed: 61 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -5,103 +5,97 @@
55
//
66
///////////////////////////////////////////////////////////////
77

8-
#include "stdafx.h"
98
#include "AI_PhraseDialogManager.h"
109
#include "PhraseDialog.h"
11-
#include "inventoryowner.h"
1210
#include "character_info.h"
1311
#include "gameobject.h"
12+
#include "inventoryowner.h"
1413
#include "relation_registry.h"
14+
#include "stdafx.h"
1515

16-
CAI_PhraseDialogManager::CAI_PhraseDialogManager (void)
16+
CAI_PhraseDialogManager::CAI_PhraseDialogManager(void)
1717
{
18-
m_sStartDialog = m_sDefaultStartDialog = NULL;
18+
m_sStartDialog = m_sDefaultStartDialog = NULL;
1919
}
2020

21-
CAI_PhraseDialogManager::~CAI_PhraseDialogManager (void)
22-
{}
21+
CAI_PhraseDialogManager::~CAI_PhraseDialogManager(void)
22+
{
23+
}
2324

24-
//PhraseDialogManager
25-
void CAI_PhraseDialogManager::ReceivePhrase (DIALOG_SHARED_PTR& phrase_dialog)
25+
// PhraseDialogManager
26+
void CAI_PhraseDialogManager::ReceivePhrase(DIALOG_SHARED_PTR& phrase_dialog)
2627
{
27-
AnswerPhrase(phrase_dialog);
28-
CPhraseDialogManager::ReceivePhrase(phrase_dialog);
28+
AnswerPhrase(phrase_dialog);
29+
CPhraseDialogManager::ReceivePhrase(phrase_dialog);
2930
}
30-
#include "uigamesp.h"
3131
#include "Level.h"
3232
#include "ui/UItalkWnd.h"
33+
#include "uigamesp.h"
3334

34-
void CAI_PhraseDialogManager::AnswerPhrase (DIALOG_SHARED_PTR& phrase_dialog)
35+
void CAI_PhraseDialogManager::AnswerPhrase(DIALOG_SHARED_PTR& phrase_dialog)
3536
{
36-
CInventoryOwner* pInvOwner = smart_cast<CInventoryOwner*>(this);
37-
THROW (pInvOwner);
38-
CGameObject* pOthersGO = smart_cast<CGameObject*>(phrase_dialog->OurPartner(this));
39-
THROW (pOthersGO);
40-
CInventoryOwner* pOthersIO = smart_cast<CInventoryOwner*>(pOthersGO);
41-
THROW (pOthersIO);
42-
43-
if(!phrase_dialog->IsFinished())
44-
{
45-
CHARACTER_GOODWILL attitude = RELATION_REGISTRY().GetAttitude(pOthersIO, pInvOwner);
46-
47-
xr_vector<int> phrases;
48-
CHARACTER_GOODWILL phrase_goodwill = NO_GOODWILL;
49-
//åñëè íå íàéäåì áîëåå ïîäõîäÿåùåé âûâîäèì ôðàçó
50-
//ïîñëåäíþþ èç ñïèñêà (ñàìóþ ãðóáóþ)
51-
int phrase_num = phrase_dialog->PhraseList().size()-1;
52-
for(u32 i=0; i<phrase_dialog->PhraseList().size(); ++i)
53-
{
54-
phrase_goodwill = phrase_dialog->PhraseList()[phrase_num]->GoodwillLevel();
55-
if(attitude >= phrase_goodwill)
56-
{
57-
phrase_num = i;
58-
break;
59-
}
60-
}
61-
62-
for(u32 i=0; i<phrase_dialog->PhraseList().size(); i++)
63-
{
64-
if(phrase_goodwill == phrase_dialog->PhraseList()[phrase_num]->GoodwillLevel())
65-
phrases.push_back(i);
66-
}
67-
68-
phrase_num = phrases[Random.randI(0, phrases.size())];
69-
70-
shared_str phrase_id = phrase_dialog->PhraseList()[phrase_num]->GetID();
71-
72-
CUIGameSP* pGameSP = smart_cast<CUIGameSP*>(CurrentGameUI());
73-
pGameSP->TalkMenu->AddAnswer (phrase_dialog->GetPhraseText(phrase_id), pInvOwner->Name());
74-
75-
CPhraseDialogManager::SayPhrase(phrase_dialog, phrase_id);
76-
}
37+
CInventoryOwner* pInvOwner = smart_cast<CInventoryOwner*>(this);
38+
THROW(pInvOwner);
39+
CGameObject* pOthersGO = smart_cast<CGameObject*>(phrase_dialog->OurPartner(this));
40+
THROW(pOthersGO);
41+
CInventoryOwner* pOthersIO = smart_cast<CInventoryOwner*>(pOthersGO);
42+
THROW(pOthersIO);
43+
44+
if (!phrase_dialog->IsFinished()) {
45+
CHARACTER_GOODWILL attitude = RELATION_REGISTRY().GetAttitude(pOthersIO, pInvOwner);
46+
47+
xr_vector<int> phrases;
48+
CHARACTER_GOODWILL phrase_goodwill = NO_GOODWILL;
49+
//åñëè íå íàéäåì áîëåå ïîäõîäÿåùåé âûâîäèì ôðàçó
50+
//ïîñëåäíþþ èç ñïèñêà (ñàìóþ ãðóáóþ)
51+
int phrase_num = phrase_dialog->PhraseList().size() - 1;
52+
for (u32 i = 0; i < phrase_dialog->PhraseList().size(); ++i)
53+
{
54+
phrase_goodwill = phrase_dialog->PhraseList()[phrase_num]->GoodwillLevel();
55+
if (attitude >= phrase_goodwill) {
56+
phrase_num = i;
57+
break;
58+
}
59+
}
60+
61+
for (u32 i = 0; i < phrase_dialog->PhraseList().size(); i++)
62+
{
63+
if (phrase_goodwill == phrase_dialog->PhraseList()[phrase_num]->GoodwillLevel()) phrases.push_back(i);
64+
}
65+
66+
phrase_num = phrases[Random.randI(0, phrases.size())];
67+
68+
shared_str phrase_id = phrase_dialog->PhraseList()[phrase_num]->GetID();
69+
70+
CUIGameSP* pGameSP = smart_cast<CUIGameSP*>(CurrentGameUI());
71+
pGameSP->TalkMenu->AddAnswer(phrase_dialog->GetPhraseText(phrase_id), pInvOwner->Name());
72+
73+
CPhraseDialogManager::SayPhrase(phrase_dialog, phrase_id);
74+
}
7775
}
7876

79-
80-
8177
void CAI_PhraseDialogManager::SetStartDialog(shared_str phrase_dialog)
8278
{
83-
m_sStartDialog = phrase_dialog;
79+
m_sStartDialog = phrase_dialog;
8480
}
8581

8682
void CAI_PhraseDialogManager::SetDefaultStartDialog(shared_str phrase_dialog)
8783
{
88-
m_sDefaultStartDialog = phrase_dialog;
84+
m_sDefaultStartDialog = phrase_dialog;
8985
}
9086

9187
void CAI_PhraseDialogManager::RestoreDefaultStartDialog()
9288
{
93-
m_sStartDialog = m_sDefaultStartDialog;
89+
m_sStartDialog = m_sDefaultStartDialog;
9490
}
9591

92+
void CAI_PhraseDialogManager::UpdateAvailableDialogs(CPhraseDialogManager* partner)
93+
{
94+
m_AvailableDialogs.clear();
95+
m_CheckedDialogs.clear();
9696

97-
void CAI_PhraseDialogManager::UpdateAvailableDialogs (CPhraseDialogManager* partner)
98-
{
99-
m_AvailableDialogs.clear();
100-
m_CheckedDialogs.clear();
101-
102-
if(*m_sStartDialog)
103-
inherited::AddAvailableDialog(*m_sStartDialog, partner);
104-
inherited::AddAvailableDialog("hello_dialog", partner);
97+
if (*m_sStartDialog) inherited::AddAvailableDialog(*m_sStartDialog, partner);
98+
inherited::AddAvailableDialog("hello_dialog", partner);
10599

106-
inherited::UpdateAvailableDialogs(partner);
100+
inherited::UpdateAvailableDialogs(partner);
107101
}

src/xrGame/AI_PhraseDialogManager.h

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,31 @@
99

1010
#include "PhraseDialogManager.h"
1111

12-
13-
class CAI_PhraseDialogManager: public CPhraseDialogManager
12+
class CAI_PhraseDialogManager : public CPhraseDialogManager
1413
{
1514
private:
16-
typedef CPhraseDialogManager inherited;
15+
typedef CPhraseDialogManager inherited;
16+
1717
public:
18-
CAI_PhraseDialogManager ();
19-
virtual ~CAI_PhraseDialogManager ();
18+
CAI_PhraseDialogManager();
19+
virtual ~CAI_PhraseDialogManager();
2020

21-
virtual void ReceivePhrase (DIALOG_SHARED_PTR& phrase_dialog);
22-
virtual void UpdateAvailableDialogs (CPhraseDialogManager* partner);
23-
virtual void AnswerPhrase (DIALOG_SHARED_PTR& phrase_dialog);
21+
virtual void ReceivePhrase(DIALOG_SHARED_PTR& phrase_dialog);
22+
virtual void UpdateAvailableDialogs(CPhraseDialogManager* partner);
23+
virtual void AnswerPhrase(DIALOG_SHARED_PTR& phrase_dialog);
2424

25+
virtual void SetStartDialog(shared_str phrase_dialog);
26+
virtual void SetDefaultStartDialog(shared_str phrase_dialog);
27+
virtual shared_str GetStartDialog() { return m_sStartDialog; }
28+
virtual void RestoreDefaultStartDialog();
2529

26-
virtual void SetStartDialog (shared_str phrase_dialog);
27-
virtual void SetDefaultStartDialog (shared_str phrase_dialog);
28-
virtual shared_str GetStartDialog () {return m_sStartDialog;}
29-
virtual void RestoreDefaultStartDialog ();
3030
protected:
31-
//äèàëîã, åñëè íå NULL, òî åãî ïåðñîíàæ çàïóñòèò
32-
//ïðè âñòðå÷å ñ àêòåðîì
33-
shared_str m_sStartDialog;
34-
shared_str m_sDefaultStartDialog;
35-
36-
DEFINE_VECTOR(DIALOG_SHARED_PTR, DIALOG_SHARED_VECTOR, DIALOG_SHARED_IT);
37-
//ñïèñîê äèàëîãîâ, íà êîòîðûå íóæíî îòâåòèòü
38-
DIALOG_SHARED_VECTOR m_PendingDialogs;
31+
//äèàëîã, åñëè íå NULL, òî åãî ïåðñîíàæ çàïóñòèò
32+
//ïðè âñòðå÷å ñ àêòåðîì
33+
shared_str m_sStartDialog;
34+
shared_str m_sDefaultStartDialog;
35+
36+
DEFINE_VECTOR(DIALOG_SHARED_PTR, DIALOG_SHARED_VECTOR, DIALOG_SHARED_IT);
37+
//ñïèñîê äèàëîãîâ, íà êîòîðûå íóæíî îòâåòèòü
38+
DIALOG_SHARED_VECTOR m_PendingDialogs;
3939
};
Lines changed: 28 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,51 @@
11
#include "stdafx.h"
22

3-
#include "activatingcharcollisiondelay.h"
43
#include "CharacterPhysicsSupport.h"
4+
#include "activatingcharcollisiondelay.h"
55
#include "phmovementcontrol.h"
6-
#ifdef DEBUG
6+
#ifdef DEBUG
77
#include "phdebug.h"
88
#endif
9-
activating_character_delay::activating_character_delay(CCharacterPhysicsSupport *char_support_):
10-
char_support(*char_support_),
11-
activate_time(Device.dwTimeGlobal + delay )
9+
activating_character_delay::activating_character_delay(CCharacterPhysicsSupport* char_support_)
10+
: char_support(*char_support_), activate_time(Device.dwTimeGlobal + delay)
1211
{
13-
VERIFY(char_support_);
14-
VERIFY(char_support.movement());
15-
VERIFY( !char_support.movement()->CharacterExist() );
12+
VERIFY(char_support_);
13+
VERIFY(char_support.movement());
14+
VERIFY(!char_support.movement()->CharacterExist());
1615
}
1716
bool activating_character_delay::active()
1817
{
19-
VERIFY(char_support.movement());
20-
return !char_support.movement()->CharacterExist();
18+
VERIFY(char_support.movement());
19+
return !char_support.movement()->CharacterExist();
2120
}
2221
void activating_character_delay::update()
2322
{
24-
if(!active())
25-
return;
23+
if (!active()) return;
2624

27-
if( Device.dwTimeGlobal < activate_time )
28-
return;
25+
if (Device.dwTimeGlobal < activate_time) return;
2926

30-
if( do_position_correct() )
31-
char_support.CreateCharacter();
27+
if (do_position_correct()) char_support.CreateCharacter();
3228

33-
activate_time = Device.dwTimeGlobal + delay;
29+
activate_time = Device.dwTimeGlobal + delay;
3430
}
3531

36-
3732
bool activating_character_delay::do_position_correct()
3833
{
39-
CPHMovementControl *m = char_support.movement();
40-
VERIFY( m );
41-
42-
IGameObject *obj = m->ParentObject();
43-
#ifdef DEBUG
44-
CEntityAlive* e_alife =smart_cast<CEntityAlive*>(obj);
45-
VERIFY(e_alife);
46-
VERIFY(!e_alife->PPhysicsShell());
47-
VERIFY(e_alife->g_Alive());
34+
CPHMovementControl* m = char_support.movement();
35+
VERIFY(m);
36+
37+
IGameObject* obj = m->ParentObject();
38+
#ifdef DEBUG
39+
CEntityAlive* e_alife = smart_cast<CEntityAlive*>(obj);
40+
VERIFY(e_alife);
41+
VERIFY(!e_alife->PPhysicsShell());
42+
VERIFY(e_alife->g_Alive());
4843
#endif
49-
VERIFY( obj );
50-
Fvector sv_pos = obj->Position();
51-
bool ret = char_support.CollisionCorrectObjPos();
52-
if(!ret)
53-
obj->Position().set(sv_pos);
54-
#if 0
44+
VERIFY(obj);
45+
Fvector sv_pos = obj->Position();
46+
bool ret = char_support.CollisionCorrectObjPos();
47+
if (!ret) obj->Position().set(sv_pos);
48+
#if 0
5549
else
5650
{
5751
DBG_OpenCashedDraw();
@@ -63,6 +57,5 @@ bool activating_character_delay::do_position_correct()
6357
DBG_ClosedCashedDraw(50000);
6458
}
6559
#endif
66-
return ret;
67-
60+
return ret;
6861
}

src/xrGame/ActivatingCharCollisionDelay.h

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@
33
#include "Common/Noncopyable.hpp"
44

55
class CCharacterPhysicsSupport;
6-
class activating_character_delay:
7-
private Noncopyable
6+
class activating_character_delay : private Noncopyable
87
{
9-
CCharacterPhysicsSupport &char_support;
10-
u32 activate_time;
11-
static const u32 delay = 3000;
8+
CCharacterPhysicsSupport& char_support;
9+
u32 activate_time;
10+
static const u32 delay = 3000;
11+
1212
public:
13-
activating_character_delay(CCharacterPhysicsSupport *char_support_);
14-
void update();
15-
bool active();
13+
activating_character_delay(CCharacterPhysicsSupport* char_support_);
14+
void update();
15+
bool active();
16+
1617
private:
17-
bool do_position_correct();
18+
bool do_position_correct();
1819
};

0 commit comments

Comments
 (0)