-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a1dda7
commit d3ed9e2
Showing
2,594 changed files
with
373,812 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
/////////////////////////////////////////////////////////////// | ||
// AI_PhraseDialogManager.cpp | ||
// Êëàññ, îò êîòîðîãî íàñëåäóþòñÿ NPC ïåðñîíàæè, âåäóùèå äèàëîã | ||
// ñ àêòåðîì | ||
// | ||
/////////////////////////////////////////////////////////////// | ||
|
||
#include "stdafx.h" | ||
#include "AI_PhraseDialogManager.h" | ||
#include "PhraseDialog.h" | ||
#include "inventoryowner.h" | ||
#include "character_info.h" | ||
#include "gameobject.h" | ||
#include "relation_registry.h" | ||
|
||
CAI_PhraseDialogManager::CAI_PhraseDialogManager (void) | ||
{ | ||
m_sStartDialog = m_sDefaultStartDialog = NULL; | ||
} | ||
|
||
CAI_PhraseDialogManager::~CAI_PhraseDialogManager (void) | ||
{} | ||
|
||
//PhraseDialogManager | ||
void CAI_PhraseDialogManager::ReceivePhrase (DIALOG_SHARED_PTR& phrase_dialog) | ||
{ | ||
AnswerPhrase(phrase_dialog); | ||
CPhraseDialogManager::ReceivePhrase(phrase_dialog); | ||
} | ||
#include "uigamesp.h" | ||
#include "hudmanager.h" | ||
#include "level.h" | ||
#include "ui/UItalkWnd.h" | ||
|
||
void CAI_PhraseDialogManager::AnswerPhrase (DIALOG_SHARED_PTR& phrase_dialog) | ||
{ | ||
CInventoryOwner* pInvOwner = smart_cast<CInventoryOwner*>(this); | ||
THROW (pInvOwner); | ||
CGameObject* pOthersGO = smart_cast<CGameObject*>(phrase_dialog->OurPartner(this)); | ||
THROW (pOthersGO); | ||
CInventoryOwner* pOthersIO = smart_cast<CInventoryOwner*>(pOthersGO); | ||
THROW (pOthersIO); | ||
|
||
if(!phrase_dialog->IsFinished()) | ||
{ | ||
CHARACTER_GOODWILL attitude = RELATION_REGISTRY().GetAttitude(pOthersIO, pInvOwner); | ||
|
||
xr_vector<int> phrases; | ||
CHARACTER_GOODWILL phrase_goodwill = NO_GOODWILL; | ||
//åñëè íå íàéäåì áîëåå ïîäõîäÿåùåé âûâîäèì ôðàçó | ||
//ïîñëåäíþþ èç ñïèñêà (ñàìóþ ãðóáóþ) | ||
int phrase_num = phrase_dialog->PhraseList().size()-1; | ||
for(u32 i=0; i<phrase_dialog->PhraseList().size(); ++i) | ||
{ | ||
phrase_goodwill = phrase_dialog->PhraseList()[phrase_num]->GoodwillLevel(); | ||
if(attitude >= phrase_goodwill) | ||
{ | ||
phrase_num = i; | ||
break; | ||
} | ||
} | ||
|
||
for(i=0; i<phrase_dialog->PhraseList().size(); i++) | ||
{ | ||
if(phrase_goodwill == phrase_dialog->PhraseList()[phrase_num]->GoodwillLevel()) | ||
phrases.push_back(i); | ||
} | ||
|
||
phrase_num = phrases[Random.randI(0, phrases.size())]; | ||
|
||
shared_str phrase_id = phrase_dialog->PhraseList()[phrase_num]->GetID(); | ||
|
||
CUIGameSP* pGameSP = smart_cast<CUIGameSP*>(CurrentGameUI()); | ||
pGameSP->TalkMenu->AddAnswer (phrase_dialog->GetPhraseText(phrase_id), pInvOwner->Name()); | ||
|
||
CPhraseDialogManager::SayPhrase(phrase_dialog, phrase_id); | ||
} | ||
} | ||
|
||
|
||
|
||
void CAI_PhraseDialogManager::SetStartDialog(shared_str phrase_dialog) | ||
{ | ||
m_sStartDialog = phrase_dialog; | ||
} | ||
|
||
void CAI_PhraseDialogManager::SetDefaultStartDialog(shared_str phrase_dialog) | ||
{ | ||
m_sDefaultStartDialog = phrase_dialog; | ||
} | ||
|
||
void CAI_PhraseDialogManager::RestoreDefaultStartDialog() | ||
{ | ||
m_sStartDialog = m_sDefaultStartDialog; | ||
} | ||
|
||
|
||
void CAI_PhraseDialogManager::UpdateAvailableDialogs (CPhraseDialogManager* partner) | ||
{ | ||
m_AvailableDialogs.clear(); | ||
m_CheckedDialogs.clear(); | ||
|
||
if(*m_sStartDialog) | ||
inherited::AddAvailableDialog(*m_sStartDialog, partner); | ||
inherited::AddAvailableDialog("hello_dialog", partner); | ||
|
||
inherited::UpdateAvailableDialogs(partner); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/////////////////////////////////////////////////////////////// | ||
// AI_PhraseDialogManager.h | ||
// Êëàññ, îò êîòîðîãî íàñëåäóþòñÿ NPC ïåðñîíàæè, âåäóùèå äèàëîã | ||
// ñ àêòåðîì | ||
// | ||
/////////////////////////////////////////////////////////////// | ||
|
||
#pragma once | ||
|
||
#include "PhraseDialogManager.h" | ||
|
||
|
||
class CAI_PhraseDialogManager: public CPhraseDialogManager | ||
{ | ||
private: | ||
typedef CPhraseDialogManager inherited; | ||
public: | ||
CAI_PhraseDialogManager (); | ||
virtual ~CAI_PhraseDialogManager (); | ||
|
||
virtual void ReceivePhrase (DIALOG_SHARED_PTR& phrase_dialog); | ||
virtual void UpdateAvailableDialogs (CPhraseDialogManager* partner); | ||
virtual void AnswerPhrase (DIALOG_SHARED_PTR& phrase_dialog); | ||
|
||
|
||
virtual void SetStartDialog (shared_str phrase_dialog); | ||
virtual void SetDefaultStartDialog (shared_str phrase_dialog); | ||
virtual shared_str GetStartDialog () {return m_sStartDialog;} | ||
virtual void RestoreDefaultStartDialog (); | ||
protected: | ||
//äèàëîã, åñëè íå NULL, òî åãî ïåðñîíàæ çàïóñòèò | ||
//ïðè âñòðå÷å ñ àêòåðîì | ||
shared_str m_sStartDialog; | ||
shared_str m_sDefaultStartDialog; | ||
|
||
DEFINE_VECTOR(DIALOG_SHARED_PTR, DIALOG_SHARED_VECTOR, DIALOG_SHARED_IT); | ||
//ñïèñîê äèàëîãîâ, íà êîòîðûå íóæíî îòâåòèòü | ||
DIALOG_SHARED_VECTOR m_PendingDialogs; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
///////////////////////////////////// | ||
// file name: AcidFog.cpp | ||
// author: lost alpha | ||
// created: 18/08/2011 | ||
// edited: 18/08/2011 | ||
// purpose: rusty fog anomaly | ||
////////////////////////////////////// | ||
#include "stdafx.h" | ||
#include "AcidFog.h" | ||
#include "hudmanager.h" | ||
#include "ParticlesObject.h" | ||
#include "level.h" | ||
#include "actor.h" | ||
#include "inventory.h" | ||
#include "physicsshellholder.h" | ||
#include "../xr_collide_form.h" | ||
|
||
#define DEFAULT_RUST_DAMAGE 0.15f | ||
|
||
CRustyFog::CRustyFog(void) | ||
{ | ||
m_dwDeltaTime = 0; | ||
m_fHitImpulseScale = 1.f; | ||
|
||
m_bLastBlowoutUpdate = false; | ||
} | ||
|
||
CRustyFog::~CRustyFog(void) | ||
{ | ||
} | ||
|
||
void CRustyFog::Load(LPCSTR section) | ||
{ | ||
inherited::Load(section); | ||
m_rust_damage = READ_IF_EXISTS(pSettings, r_float, section, "rusty_damage", DEFAULT_RUST_DAMAGE); | ||
} | ||
|
||
|
||
void CRustyFog::Postprocess(f32 /**val/**/) | ||
{ | ||
} | ||
|
||
bool CRustyFog::BlowoutState() | ||
{ | ||
bool result = inherited::BlowoutState(); | ||
if(!result) | ||
{ | ||
m_bLastBlowoutUpdate = false; | ||
UpdateBlowout(); | ||
} | ||
else if(!m_bLastBlowoutUpdate) | ||
{ | ||
m_bLastBlowoutUpdate = true; | ||
UpdateBlowout(); | ||
} | ||
|
||
return result; | ||
} | ||
|
||
void CRustyFog::Affect(SZoneObjectInfo* O) | ||
{ | ||
CPhysicsShellHolder *pGameObject = smart_cast<CPhysicsShellHolder*>(O->object); | ||
if(!pGameObject) return; | ||
|
||
if(O->zone_ignore) return; | ||
|
||
Fvector P; | ||
XFORM().transform_tiny(P,CFORM()->getSphere().P); | ||
|
||
#ifdef DEBUG | ||
char l_pow[255]; | ||
xr_sprintf(l_pow, "zone hit. %.1f", Power(pGameObject->Position().distance_to(P))); | ||
if(bDebug) Msg("%s %s",*pGameObject->cName(), l_pow); | ||
#endif | ||
|
||
Fvector hit_dir; | ||
hit_dir.set(::Random.randF(-.5f,.5f), | ||
::Random.randF(.0f,1.f), | ||
::Random.randF(-.5f,.5f)); | ||
hit_dir.normalize(); | ||
|
||
|
||
Fvector position_in_bone_space; | ||
|
||
VERIFY(!pGameObject->getDestroy()); | ||
|
||
float dist = pGameObject->Position().distance_to(P) - pGameObject->Radius(); | ||
float power = Power(dist>0.f?dist:0.f); | ||
float impulse = m_fHitImpulseScale*power*pGameObject->GetMass(); | ||
|
||
//ñòàòèñòèêà ïî îáúåêòó | ||
O->total_damage += power; | ||
O->hit_num++; | ||
|
||
if(power > 0.01f) | ||
{ | ||
m_dwDeltaTime = 0; | ||
position_in_bone_space.set(0.f,0.f,0.f); | ||
|
||
CreateHit(pGameObject->ID(),ID(),hit_dir,power,0,position_in_bone_space,impulse,m_eHitTypeBlowout); | ||
|
||
PlayHitParticles(pGameObject); | ||
} | ||
if (pGameObject->ID() == Actor()->ID()) | ||
RustyItems(); | ||
} | ||
|
||
#define RUSTY_ITEM(item, val) \ | ||
if (item) \ | ||
item->ChangeCondition(item->GetCondition() - val); \ | ||
|
||
|
||
void CRustyFog::RustyItems() | ||
{ | ||
auto& slots = Actor()->inventory().m_slots; | ||
RUSTY_ITEM(slots[PISTOL_SLOT].m_pIItem, m_rust_damage); | ||
RUSTY_ITEM(slots[RIFLE_SLOT].m_pIItem, m_rust_damage); | ||
RUSTY_ITEM(slots[RIFLE_2_SLOT].m_pIItem, m_rust_damage); | ||
RUSTY_ITEM(slots[OUTFIT_SLOT].m_pIItem, m_rust_damage); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
///////////////////////////////////// | ||
// file name: AcidFog.h | ||
// author: lost alpha | ||
// created: 18/08/2011 | ||
// edited: 18/08/2011 | ||
// purpose: rusty fog anomaly | ||
////////////////////////////////////// | ||
#pragma once | ||
|
||
#include "customzone.h" | ||
#include "script_export_space.h" | ||
|
||
class CRustyFog : public CCustomZone | ||
{ | ||
private: | ||
typedef CCustomZone inherited; | ||
public: | ||
CRustyFog(void); | ||
virtual ~CRustyFog(void); | ||
|
||
virtual void Load(LPCSTR section); | ||
virtual void Postprocess(f32 val); | ||
virtual bool EnableEffector() {return true;} | ||
|
||
|
||
virtual void Affect(SZoneObjectInfo* O); | ||
|
||
protected: | ||
virtual bool BlowoutState(); | ||
bool m_bLastBlowoutUpdate; | ||
private: | ||
void RustyItems(); | ||
float m_rust_damage; | ||
public: | ||
DECLARE_SCRIPT_REGISTER_FUNCTION | ||
}; | ||
add_to_type_list(CRustyFog) | ||
#undef script_type_list | ||
#define script_type_list save_type_list(CRustyFog) |
Oops, something went wrong.