Skip to content

Commit

Permalink
Merge pull request #152 from revolucas/fixes_only
Browse files Browse the repository at this point in the history
Fixes only
  • Loading branch information
CasualDev242 committed Dec 30, 2016
2 parents 456e8b6 + 2754d42 commit 114458e
Show file tree
Hide file tree
Showing 11 changed files with 122 additions and 99 deletions.
25 changes: 16 additions & 9 deletions res/gamedata/scripts/ui_sleep_dialog.script
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ function sleep_dialog:__init() super()
if(device().width/device().height>(1024/768+0.01)) then
wide = true
end

self:SetAutoDelete(true)

local xml = CScriptXmlInit()
xml:ParseFile("ui_sleep_dialog.xml")
Expand All @@ -18,10 +20,10 @@ function sleep_dialog:__init() super()
self.static_cover = xml:InitStatic("static_cover", self.back)
self.st_marker = xml:InitStatic("st_marker", self.static_cover)

sleep_st_tbl = {}
for i = 1, 24 do
sleep_st_tbl[i] = xml:InitStatic("sleep_st_"..i, self.back)
end
self.sleep_st_tbl = {}
for i = 1, 24 do
self.sleep_st_tbl[i] = xml:InitStatic("sleep_st_"..i, self.back)
end

self.time_track = xml:InitTrackBar("time_track", self.back)
self:Register(self.time_track, "time_track")
Expand All @@ -33,6 +35,7 @@ function sleep_dialog:__init() super()
self:Register(self.btn_cancel, "btn_cancel")

self.sleep_mb = CUIMessageBoxEx()
self.sleep_mb:self:SetAutoDelete(true)
self:Register(self.sleep_mb, "sleep_mb")
--------------------------------------------------------------------------------
self:AddCallback("btn_sleep", ui_events.BUTTON_CLICKED, self.OnButtonSleep, self)
Expand All @@ -43,11 +46,11 @@ end
function sleep_dialog:Initialize()
local cur_hours = level.get_time_hours()
for i = 1, 24 do
local hours = cur_hours + i
if(hours>=24) then
hours = hours - 24
end
sleep_st_tbl[i]:TextControl():SetText(hours..game.translate_string("st_sleep_hours"))
local hours = cur_hours + i
if(hours>=24) then
hours = hours - 24
end
self.sleep_st_tbl[i]:TextControl():SetText(hours..game.translate_string("st_sleep_hours"))
end

local delta = math.floor(591/24*cur_hours)
Expand All @@ -72,6 +75,10 @@ function sleep_dialog:Initialize()
self.sleep_static2:SetWndPos(pos)
end

function sleep_dialog:__finalize()
sleep_control = nil
end

function sleep_dialog:TestAndShow()
if(db.actor.bleeding>0 or db.actor.radiation>0) then
self.sleep_mb:InitMessageBox("message_box_ok")
Expand Down
3 changes: 3 additions & 0 deletions src/xrCore/LocatorAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,9 @@ IC bool pred_str_ff(const _finddata_t& x, const _finddata_t& y)

bool ignore_name(const char* _name)
{
// ignore windows hidden Thumbs.db
if (0 == strcmp(_name, "Thumbs.db"))
return true;
// ignore processing ".svn" folders
return (_name[0] == '.' && _name[1] == 's' && _name[2] == 'v' && _name[3] == 'n' && _name[4] == 0);
}
Expand Down
3 changes: 1 addition & 2 deletions src/xrGame/Actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,15 +244,14 @@ struct SDefNewsMsg{
void detach_Vehicle ();
void steer_Vehicle (float angle);
void attach_Vehicle (CHolderCustom* vehicle);

bool use_MountedWeapon (CHolderCustom* object);
virtual bool can_attach (const CInventoryItem *inventory_item) const;
protected:
CHolderCustom* m_holder;
u16 m_holderID;
bool use_Holder (CHolderCustom* holder);

bool use_Vehicle (CHolderCustom* object);
bool use_MountedWeapon (CHolderCustom* object);
void ActorUse ();

protected:
Expand Down
1 change: 0 additions & 1 deletion src/xrGame/ActorAnimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ void CActor::g_SetSprintAnimation( u32 mstate_rl,MotionID &head,MotionID &torso,
SActorSprintState& sprint = m_anims->m_sprint;

bool jump = (mstate_rl&mcFall) ||
(mstate_rl&mcLanding) ||
(mstate_rl&mcLanding) ||
(mstate_rl&mcLanding2) ||
(mstate_rl&mcJump) ;
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/DestroyablePhysicsObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ CDestroyablePhysicsObject::~CDestroyablePhysicsObject()
void CDestroyablePhysicsObject::OnChangeVisual()
{
if (m_pPhysicsShell){
if(m_pPhysicsShell)m_pPhysicsShell->Deactivate();
m_pPhysicsShell->Deactivate();
xr_delete (m_pPhysicsShell);
VERIFY (0==Visual());
}
Expand Down
5 changes: 5 additions & 0 deletions src/xrGame/Entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,11 @@ void CEntity::net_Destroy ()

void CEntity::KillEntity(u16 whoID)
{
if (this->ID() == Actor()->ID())
{
Actor()->detach_Vehicle();
Actor()->use_MountedWeapon(NULL);
}
if (whoID != ID()) {
#ifdef DEBUG
if (m_killer_id != ALife::_OBJECT_ID(-1)) {
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/HudSound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void HUD_SOUND_ITEM::PlaySound( HUD_SOUND_ITEM& hud_snd,
flags,
hud_snd.m_activeSnd->delay);

hud_snd.m_activeSnd->snd.set_volume (hud_snd.m_activeSnd->volume * b_hud_mode?psHUDSoundVolume:1.0f);
hud_snd.m_activeSnd->snd.set_volume(hud_snd.m_activeSnd->volume * (b_hud_mode ? psHUDSoundVolume : 1.0f));
}

void HUD_SOUND_ITEM::StopSound(HUD_SOUND_ITEM& hud_snd)
Expand Down
155 changes: 78 additions & 77 deletions src/xrGame/Level_bullet_manager_firetrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ extern float gCheckHitK;
//return TRUE-òåñòèðîâàòü îáúåêò / FALSE-ïðîïóñòèòü îáúåêò
BOOL CBulletManager::test_callback(const collide::ray_defs& rd, IGameObject* object, LPVOID params)
{
if (!object)
return TRUE;

bullet_test_callback_data* pData = (bullet_test_callback_data*)params;
SBullet* bullet = pData->pBullet;

Expand All @@ -44,97 +47,95 @@ BOOL CBulletManager::test_callback(const collide::ray_defs& rd, IGameObject* obj
(!bullet->flags.ricochet_was)) return FALSE;

BOOL bRes = TRUE;
if (object){
CEntity* entity = smart_cast<CEntity*>(object);
if (entity&&entity->g_Alive()&&(entity->ID()!=bullet->parent_id)){
ICollisionForm* cform = entity->GetCForm();
if ((NULL!=cform) && (cftObject==cform->Type())){
CActor* actor = smart_cast<CActor*>(entity);
CAI_Stalker* stalker= smart_cast<CAI_Stalker*>(entity);
// â êîãî ïîïàëè?
if (actor && IsGameTypeSingle()/**/||stalker/**/){
// ïîïàëè â àêòåðà èëè ñòàëêåðà
Fsphere S = cform->getSphere();
entity->XFORM().transform_tiny (S.P) ;
float dist = rd.range;
// ïðîâåðèì ïîïàëè ëè ìû â îïèñûâàþùóþ ñôåðó
if (Fsphere::rpNone!=S.intersect_full(bullet->bullet_pos, bullet->dir, dist))
{
// äà ïîïàëè, íàéäåì êòî ñòðåëÿë
bool play_whine = true;
IGameObject* initiator = Level().Objects.net_Find (bullet->parent_id);
if (actor){
// ïîïàëè â àêòåðà
float hpf = 1.f;
float ahp = actor->HitProbability();
CEntity* entity = smart_cast<CEntity*>(object);
if (entity&&entity->g_Alive()&&(entity->ID()!=bullet->parent_id)){
ICollisionForm* cform = entity->GetCForm();
if ((NULL!=cform) && (cftObject==cform->Type())){
CActor* actor = smart_cast<CActor*>(entity);
CAI_Stalker* stalker= smart_cast<CAI_Stalker*>(entity);
// â êîãî ïîïàëè?
if (actor && IsGameTypeSingle()/**/||stalker/**/){
// ïîïàëè â àêòåðà èëè ñòàëêåðà
Fsphere S = cform->getSphere();
entity->XFORM().transform_tiny (S.P) ;
float dist = rd.range;
// ïðîâåðèì ïîïàëè ëè ìû â îïèñûâàþùóþ ñôåðó
if (Fsphere::rpNone!=S.intersect_full(bullet->bullet_pos, bullet->dir, dist))
{
// äà ïîïàëè, íàéäåì êòî ñòðåëÿë
bool play_whine = true;
IGameObject* initiator = Level().Objects.net_Find (bullet->parent_id);
if (actor){
// ïîïàëè â àêòåðà
float hpf = 1.f;
float ahp = actor->HitProbability();
#if 1
# if 0
IGameObject *weapon_object = Level().Objects.net_Find (bullet->weapon_id);
if (weapon_object) {
CWeapon *weapon = smart_cast<CWeapon*>(weapon_object);
if (weapon) {
float fly_dist = bullet->fly_dist+dist;
float dist_factor = _min(1.f,fly_dist/Level().BulletManager().m_fHPMaxDist);
ahp = dist_factor*weapon->hit_probability() + (1.f-dist_factor)*1.f;
}
IGameObject *weapon_object = Level().Objects.net_Find (bullet->weapon_id);
if (weapon_object) {
CWeapon *weapon = smart_cast<CWeapon*>(weapon_object);
if (weapon) {
float fly_dist = bullet->fly_dist+dist;
float dist_factor = _min(1.f,fly_dist/Level().BulletManager().m_fHPMaxDist);
ahp = dist_factor*weapon->hit_probability() + (1.f-dist_factor)*1.f;
}
}
# else
float game_difficulty_hit_probability = actor->HitProbability();
CAI_Stalker *stalker = smart_cast<CAI_Stalker*>(initiator);
if (stalker)
hpf = stalker->SpecificCharacter().hit_probability_factor();

float dist_factor = 1.f;
IGameObject *weapon_object = Level().Objects.net_Find (bullet->weapon_id);
if (weapon_object) {
CWeapon *weapon = smart_cast<CWeapon*>(weapon_object);
if (weapon) {
game_difficulty_hit_probability = weapon->hit_probability();
float fly_dist = bullet->fly_dist+dist;
dist_factor = _min(1.f,fly_dist/Level().BulletManager().m_fHPMaxDist);
}
float game_difficulty_hit_probability = actor->HitProbability();
CAI_Stalker *stalker = smart_cast<CAI_Stalker*>(initiator);
if (stalker)
hpf = stalker->SpecificCharacter().hit_probability_factor();

float dist_factor = 1.f;
IGameObject *weapon_object = Level().Objects.net_Find (bullet->weapon_id);
if (weapon_object) {
CWeapon *weapon = smart_cast<CWeapon*>(weapon_object);
if (weapon) {
game_difficulty_hit_probability = weapon->hit_probability();
float fly_dist = bullet->fly_dist+dist;
dist_factor = _min(1.f,fly_dist/Level().BulletManager().m_fHPMaxDist);
}
}

ahp = dist_factor*game_difficulty_hit_probability + (1.f-dist_factor)*1.f;
ahp = dist_factor*game_difficulty_hit_probability + (1.f-dist_factor)*1.f;
# endif
#else
CAI_Stalker* i_stalker = smart_cast<CAI_Stalker*>(initiator);
// åñëè ñòðåëÿë ñòàëêåð, ó÷èòûâàåì - hit_probability_factor ñòàëêåða èíà÷å - 1.0
if (i_stalker) {
hpf = i_stalker->SpecificCharacter().hit_probability_factor();
float fly_dist = bullet->fly_dist+dist;
float dist_factor = _min(1.f,fly_dist/Level().BulletManager().m_fHPMaxDist);
ahp = dist_factor*actor->HitProbability() + (1.f-dist_factor)*1.f;
}
CAI_Stalker* i_stalker = smart_cast<CAI_Stalker*>(initiator);
// åñëè ñòðåëÿë ñòàëêåð, ó÷èòûâàåì - hit_probability_factor ñòàëêåða èíà÷å - 1.0
if (i_stalker) {
hpf = i_stalker->SpecificCharacter().hit_probability_factor();
float fly_dist = bullet->fly_dist+dist;
float dist_factor = _min(1.f,fly_dist/Level().BulletManager().m_fHPMaxDist);
ahp = dist_factor*actor->HitProbability() + (1.f-dist_factor)*1.f;
}
#endif
if (Random.randF(0.f,1.f)>(ahp*hpf)){
bRes = FALSE; // don't hit actor
play_whine = true; // play whine sound
if (Random.randF(0.f,1.f)>(ahp*hpf)){
bRes = FALSE; // don't hit actor
play_whine = true; // play whine sound
}else{
// real test actor CFORM
Level().BulletManager().m_rq_results.r_clear();

if (cform->_RayQuery(rd,Level().BulletManager().m_rq_results)){
bRes = TRUE; // hit actor
play_whine = false; // don't play whine sound
}else{
// real test actor CFORM
Level().BulletManager().m_rq_results.r_clear();

if (cform->_RayQuery(rd,Level().BulletManager().m_rq_results)){
bRes = TRUE; // hit actor
play_whine = false; // don't play whine sound
}else{
bRes = FALSE; // don't hit actor
play_whine = true; // play whine sound
}
bRes = FALSE; // don't hit actor
play_whine = true; // play whine sound
}
}
// play whine sound
if (play_whine){
Fvector pt;
pt.mad (bullet->bullet_pos, bullet->dir, dist);
Level().BulletManager().PlayWhineSound (bullet,initiator,pt);
}
}else{
// don't test this object again (return FALSE)
bRes = FALSE;
}

// play whine sound
if (play_whine){
Fvector pt;
pt.mad (bullet->bullet_pos, bullet->dir, dist);
Level().BulletManager().PlayWhineSound (bullet,initiator,pt);
}
}else{
// don't test this object again (return FALSE)
bRes = FALSE;
}

}
}
}
Expand Down
10 changes: 7 additions & 3 deletions src/xrGame/alife_online_offline_group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ void CSE_ALifeOnlineOfflineGroup::switch_online ()
MEMBERS::iterator I = m_members.begin();
MEMBERS::iterator E = m_members.end();
for ( ; I != E; ++I){
alife().add_online ((*I).second, false);
if ((*I).second->m_bOnline == false)
alife().add_online((*I).second, false);
}

alife().scheduled().remove (this);
Expand All @@ -257,8 +258,11 @@ void CSE_ALifeOnlineOfflineGroup::switch_offline ()
MEMBERS::iterator I = m_members.begin();
MEMBERS::iterator E = m_members.end();
for ( ; I != E; ++I){
(*I).second->clear_client_data();
alife().remove_online ((*I).second, false);
if ((*I).second->m_bOnline == true)
{
(*I).second->clear_client_data();
alife().remove_online ((*I).second, false);
}
}

alife().scheduled().add (this);
Expand Down
6 changes: 3 additions & 3 deletions src/xrGame/inventory_item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ void CInventoryItem::Load(LPCSTR section)
m_Description = CStringTable().translate( pSettings->r_string(section, "description") );

m_flags.set(Fbelt, READ_IF_EXISTS(pSettings, r_bool, section, "belt", FALSE));
m_can_trade = READ_IF_EXISTS(pSettings, r_bool, section, "can_take", TRUE);
m_flags.set(FCanTake, m_can_trade);
m_flags.set(FCanTrade, READ_IF_EXISTS(pSettings, r_bool, section, "can_trade", TRUE));
m_can_trade = READ_IF_EXISTS(pSettings, r_bool, section, "can_trade", TRUE);
m_flags.set(FCanTake, READ_IF_EXISTS(pSettings, r_bool, section, "can_take", TRUE));
m_flags.set(FCanTrade, m_can_trade);
m_flags.set(FIsQuestItem, READ_IF_EXISTS(pSettings, r_bool, section, "quest_item",FALSE));


Expand Down
9 changes: 7 additions & 2 deletions src/xrGame/stalker_animation_manager_update.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,13 @@ void CStalkerAnimationManager::update ()
update_impl ();
}
catch(...) {
Msg ("! error in stalker with visual %s",*object().cNameVisual());
throw;
Msg("! error in stalker with visual %s and ID %s",*object().cNameVisual(),object().ID());
head().reset();
torso().reset();
legs().reset();
global().reset();
return;
//throw;
}
STOP_PROFILE
}

0 comments on commit 114458e

Please sign in to comment.