Skip to content

Commit 114458e

Browse files
authored
Merge pull request #152 from revolucas/fixes_only
Fixes only
2 parents 456e8b6 + 2754d42 commit 114458e

11 files changed

+122
-99
lines changed

res/gamedata/scripts/ui_sleep_dialog.script

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ function sleep_dialog:__init() super()
66
if(device().width/device().height>(1024/768+0.01)) then
77
wide = true
88
end
9+
10+
self:SetAutoDelete(true)
911

1012
local xml = CScriptXmlInit()
1113
xml:ParseFile("ui_sleep_dialog.xml")
@@ -18,10 +20,10 @@ function sleep_dialog:__init() super()
1820
self.static_cover = xml:InitStatic("static_cover", self.back)
1921
self.st_marker = xml:InitStatic("st_marker", self.static_cover)
2022

21-
sleep_st_tbl = {}
22-
for i = 1, 24 do
23-
sleep_st_tbl[i] = xml:InitStatic("sleep_st_"..i, self.back)
24-
end
23+
self.sleep_st_tbl = {}
24+
for i = 1, 24 do
25+
self.sleep_st_tbl[i] = xml:InitStatic("sleep_st_"..i, self.back)
26+
end
2527

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

3537
self.sleep_mb = CUIMessageBoxEx()
38+
self.sleep_mb:self:SetAutoDelete(true)
3639
self:Register(self.sleep_mb, "sleep_mb")
3740
--------------------------------------------------------------------------------
3841
self:AddCallback("btn_sleep", ui_events.BUTTON_CLICKED, self.OnButtonSleep, self)
@@ -43,11 +46,11 @@ end
4346
function sleep_dialog:Initialize()
4447
local cur_hours = level.get_time_hours()
4548
for i = 1, 24 do
46-
local hours = cur_hours + i
47-
if(hours>=24) then
48-
hours = hours - 24
49-
end
50-
sleep_st_tbl[i]:TextControl():SetText(hours..game.translate_string("st_sleep_hours"))
49+
local hours = cur_hours + i
50+
if(hours>=24) then
51+
hours = hours - 24
52+
end
53+
self.sleep_st_tbl[i]:TextControl():SetText(hours..game.translate_string("st_sleep_hours"))
5154
end
5255

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

78+
function sleep_dialog:__finalize()
79+
sleep_control = nil
80+
end
81+
7582
function sleep_dialog:TestAndShow()
7683
if(db.actor.bleeding>0 or db.actor.radiation>0) then
7784
self.sleep_mb:InitMessageBox("message_box_ok")

src/xrCore/LocatorAPI.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,9 @@ IC bool pred_str_ff(const _finddata_t& x, const _finddata_t& y)
537537

538538
bool ignore_name(const char* _name)
539539
{
540+
// ignore windows hidden Thumbs.db
541+
if (0 == strcmp(_name, "Thumbs.db"))
542+
return true;
540543
// ignore processing ".svn" folders
541544
return (_name[0] == '.' && _name[1] == 's' && _name[2] == 'v' && _name[3] == 'n' && _name[4] == 0);
542545
}

src/xrGame/Actor.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,14 @@ struct SDefNewsMsg{
244244
void detach_Vehicle ();
245245
void steer_Vehicle (float angle);
246246
void attach_Vehicle (CHolderCustom* vehicle);
247-
247+
bool use_MountedWeapon (CHolderCustom* object);
248248
virtual bool can_attach (const CInventoryItem *inventory_item) const;
249249
protected:
250250
CHolderCustom* m_holder;
251251
u16 m_holderID;
252252
bool use_Holder (CHolderCustom* holder);
253253

254254
bool use_Vehicle (CHolderCustom* object);
255-
bool use_MountedWeapon (CHolderCustom* object);
256255
void ActorUse ();
257256

258257
protected:

src/xrGame/ActorAnimation.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,6 @@ void CActor::g_SetSprintAnimation( u32 mstate_rl,MotionID &head,MotionID &torso,
288288
SActorSprintState& sprint = m_anims->m_sprint;
289289

290290
bool jump = (mstate_rl&mcFall) ||
291-
(mstate_rl&mcLanding) ||
292291
(mstate_rl&mcLanding) ||
293292
(mstate_rl&mcLanding2) ||
294293
(mstate_rl&mcJump) ;

src/xrGame/DestroyablePhysicsObject.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ CDestroyablePhysicsObject::~CDestroyablePhysicsObject()
3030
void CDestroyablePhysicsObject::OnChangeVisual()
3131
{
3232
if (m_pPhysicsShell){
33-
if(m_pPhysicsShell)m_pPhysicsShell->Deactivate();
33+
m_pPhysicsShell->Deactivate();
3434
xr_delete (m_pPhysicsShell);
3535
VERIFY (0==Visual());
3636
}

src/xrGame/Entity.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,11 @@ void CEntity::net_Destroy ()
246246

247247
void CEntity::KillEntity(u16 whoID)
248248
{
249+
if (this->ID() == Actor()->ID())
250+
{
251+
Actor()->detach_Vehicle();
252+
Actor()->use_MountedWeapon(NULL);
253+
}
249254
if (whoID != ID()) {
250255
#ifdef DEBUG
251256
if (m_killer_id != ALife::_OBJECT_ID(-1)) {

src/xrGame/HudSound.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ void HUD_SOUND_ITEM::PlaySound( HUD_SOUND_ITEM& hud_snd,
105105
flags,
106106
hud_snd.m_activeSnd->delay);
107107

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

111111
void HUD_SOUND_ITEM::StopSound(HUD_SOUND_ITEM& hud_snd)

src/xrGame/Level_bullet_manager_firetrace.cpp

Lines changed: 78 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ extern float gCheckHitK;
3636
//return TRUE-òåñòèðîâàòü îáúåêò / FALSE-ïðîïóñòèòü îáúåêò
3737
BOOL CBulletManager::test_callback(const collide::ray_defs& rd, IGameObject* object, LPVOID params)
3838
{
39+
if (!object)
40+
return TRUE;
41+
3942
bullet_test_callback_data* pData = (bullet_test_callback_data*)params;
4043
SBullet* bullet = pData->pBullet;
4144

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

4649
BOOL bRes = TRUE;
47-
if (object){
48-
CEntity* entity = smart_cast<CEntity*>(object);
49-
if (entity&&entity->g_Alive()&&(entity->ID()!=bullet->parent_id)){
50-
ICollisionForm* cform = entity->GetCForm();
51-
if ((NULL!=cform) && (cftObject==cform->Type())){
52-
CActor* actor = smart_cast<CActor*>(entity);
53-
CAI_Stalker* stalker= smart_cast<CAI_Stalker*>(entity);
54-
// â êîãî ïîïàëè?
55-
if (actor && IsGameTypeSingle()/**/||stalker/**/){
56-
// ïîïàëè â àêòåðà èëè ñòàëêåðà
57-
Fsphere S = cform->getSphere();
58-
entity->XFORM().transform_tiny (S.P) ;
59-
float dist = rd.range;
60-
// ïðîâåðèì ïîïàëè ëè ìû â îïèñûâàþùóþ ñôåðó
61-
if (Fsphere::rpNone!=S.intersect_full(bullet->bullet_pos, bullet->dir, dist))
62-
{
63-
// äà ïîïàëè, íàéäåì êòî ñòðåëÿë
64-
bool play_whine = true;
65-
IGameObject* initiator = Level().Objects.net_Find (bullet->parent_id);
66-
if (actor){
67-
// ïîïàëè â àêòåðà
68-
float hpf = 1.f;
69-
float ahp = actor->HitProbability();
50+
CEntity* entity = smart_cast<CEntity*>(object);
51+
if (entity&&entity->g_Alive()&&(entity->ID()!=bullet->parent_id)){
52+
ICollisionForm* cform = entity->GetCForm();
53+
if ((NULL!=cform) && (cftObject==cform->Type())){
54+
CActor* actor = smart_cast<CActor*>(entity);
55+
CAI_Stalker* stalker= smart_cast<CAI_Stalker*>(entity);
56+
// â êîãî ïîïàëè?
57+
if (actor && IsGameTypeSingle()/**/||stalker/**/){
58+
// ïîïàëè â àêòåðà èëè ñòàëêåðà
59+
Fsphere S = cform->getSphere();
60+
entity->XFORM().transform_tiny (S.P) ;
61+
float dist = rd.range;
62+
// ïðîâåðèì ïîïàëè ëè ìû â îïèñûâàþùóþ ñôåðó
63+
if (Fsphere::rpNone!=S.intersect_full(bullet->bullet_pos, bullet->dir, dist))
64+
{
65+
// äà ïîïàëè, íàéäåì êòî ñòðåëÿë
66+
bool play_whine = true;
67+
IGameObject* initiator = Level().Objects.net_Find (bullet->parent_id);
68+
if (actor){
69+
// ïîïàëè â àêòåðà
70+
float hpf = 1.f;
71+
float ahp = actor->HitProbability();
7072
#if 1
7173
# if 0
72-
IGameObject *weapon_object = Level().Objects.net_Find (bullet->weapon_id);
73-
if (weapon_object) {
74-
CWeapon *weapon = smart_cast<CWeapon*>(weapon_object);
75-
if (weapon) {
76-
float fly_dist = bullet->fly_dist+dist;
77-
float dist_factor = _min(1.f,fly_dist/Level().BulletManager().m_fHPMaxDist);
78-
ahp = dist_factor*weapon->hit_probability() + (1.f-dist_factor)*1.f;
79-
}
74+
IGameObject *weapon_object = Level().Objects.net_Find (bullet->weapon_id);
75+
if (weapon_object) {
76+
CWeapon *weapon = smart_cast<CWeapon*>(weapon_object);
77+
if (weapon) {
78+
float fly_dist = bullet->fly_dist+dist;
79+
float dist_factor = _min(1.f,fly_dist/Level().BulletManager().m_fHPMaxDist);
80+
ahp = dist_factor*weapon->hit_probability() + (1.f-dist_factor)*1.f;
8081
}
82+
}
8183
# else
82-
float game_difficulty_hit_probability = actor->HitProbability();
83-
CAI_Stalker *stalker = smart_cast<CAI_Stalker*>(initiator);
84-
if (stalker)
85-
hpf = stalker->SpecificCharacter().hit_probability_factor();
86-
87-
float dist_factor = 1.f;
88-
IGameObject *weapon_object = Level().Objects.net_Find (bullet->weapon_id);
89-
if (weapon_object) {
90-
CWeapon *weapon = smart_cast<CWeapon*>(weapon_object);
91-
if (weapon) {
92-
game_difficulty_hit_probability = weapon->hit_probability();
93-
float fly_dist = bullet->fly_dist+dist;
94-
dist_factor = _min(1.f,fly_dist/Level().BulletManager().m_fHPMaxDist);
95-
}
84+
float game_difficulty_hit_probability = actor->HitProbability();
85+
CAI_Stalker *stalker = smart_cast<CAI_Stalker*>(initiator);
86+
if (stalker)
87+
hpf = stalker->SpecificCharacter().hit_probability_factor();
88+
89+
float dist_factor = 1.f;
90+
IGameObject *weapon_object = Level().Objects.net_Find (bullet->weapon_id);
91+
if (weapon_object) {
92+
CWeapon *weapon = smart_cast<CWeapon*>(weapon_object);
93+
if (weapon) {
94+
game_difficulty_hit_probability = weapon->hit_probability();
95+
float fly_dist = bullet->fly_dist+dist;
96+
dist_factor = _min(1.f,fly_dist/Level().BulletManager().m_fHPMaxDist);
9697
}
98+
}
9799

98-
ahp = dist_factor*game_difficulty_hit_probability + (1.f-dist_factor)*1.f;
100+
ahp = dist_factor*game_difficulty_hit_probability + (1.f-dist_factor)*1.f;
99101
# endif
100102
#else
101-
CAI_Stalker* i_stalker = smart_cast<CAI_Stalker*>(initiator);
102-
// åñëè ñòðåëÿë ñòàëêåð, ó÷èòûâàåì - hit_probability_factor ñòàëêåða èíà÷å - 1.0
103-
if (i_stalker) {
104-
hpf = i_stalker->SpecificCharacter().hit_probability_factor();
105-
float fly_dist = bullet->fly_dist+dist;
106-
float dist_factor = _min(1.f,fly_dist/Level().BulletManager().m_fHPMaxDist);
107-
ahp = dist_factor*actor->HitProbability() + (1.f-dist_factor)*1.f;
108-
}
103+
CAI_Stalker* i_stalker = smart_cast<CAI_Stalker*>(initiator);
104+
// åñëè ñòðåëÿë ñòàëêåð, ó÷èòûâàåì - hit_probability_factor ñòàëêåða èíà÷å - 1.0
105+
if (i_stalker) {
106+
hpf = i_stalker->SpecificCharacter().hit_probability_factor();
107+
float fly_dist = bullet->fly_dist+dist;
108+
float dist_factor = _min(1.f,fly_dist/Level().BulletManager().m_fHPMaxDist);
109+
ahp = dist_factor*actor->HitProbability() + (1.f-dist_factor)*1.f;
110+
}
109111
#endif
110-
if (Random.randF(0.f,1.f)>(ahp*hpf)){
111-
bRes = FALSE; // don't hit actor
112-
play_whine = true; // play whine sound
112+
if (Random.randF(0.f,1.f)>(ahp*hpf)){
113+
bRes = FALSE; // don't hit actor
114+
play_whine = true; // play whine sound
115+
}else{
116+
// real test actor CFORM
117+
Level().BulletManager().m_rq_results.r_clear();
118+
119+
if (cform->_RayQuery(rd,Level().BulletManager().m_rq_results)){
120+
bRes = TRUE; // hit actor
121+
play_whine = false; // don't play whine sound
113122
}else{
114-
// real test actor CFORM
115-
Level().BulletManager().m_rq_results.r_clear();
116-
117-
if (cform->_RayQuery(rd,Level().BulletManager().m_rq_results)){
118-
bRes = TRUE; // hit actor
119-
play_whine = false; // don't play whine sound
120-
}else{
121-
bRes = FALSE; // don't hit actor
122-
play_whine = true; // play whine sound
123-
}
123+
bRes = FALSE; // don't hit actor
124+
play_whine = true; // play whine sound
124125
}
125126
}
126-
// play whine sound
127-
if (play_whine){
128-
Fvector pt;
129-
pt.mad (bullet->bullet_pos, bullet->dir, dist);
130-
Level().BulletManager().PlayWhineSound (bullet,initiator,pt);
131-
}
132-
}else{
133-
// don't test this object again (return FALSE)
134-
bRes = FALSE;
135127
}
136-
128+
// play whine sound
129+
if (play_whine){
130+
Fvector pt;
131+
pt.mad (bullet->bullet_pos, bullet->dir, dist);
132+
Level().BulletManager().PlayWhineSound (bullet,initiator,pt);
133+
}
134+
}else{
135+
// don't test this object again (return FALSE)
136+
bRes = FALSE;
137137
}
138+
138139
}
139140
}
140141
}

src/xrGame/alife_online_offline_group.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,8 @@ void CSE_ALifeOnlineOfflineGroup::switch_online ()
231231
MEMBERS::iterator I = m_members.begin();
232232
MEMBERS::iterator E = m_members.end();
233233
for ( ; I != E; ++I){
234-
alife().add_online ((*I).second, false);
234+
if ((*I).second->m_bOnline == false)
235+
alife().add_online((*I).second, false);
235236
}
236237

237238
alife().scheduled().remove (this);
@@ -257,8 +258,11 @@ void CSE_ALifeOnlineOfflineGroup::switch_offline ()
257258
MEMBERS::iterator I = m_members.begin();
258259
MEMBERS::iterator E = m_members.end();
259260
for ( ; I != E; ++I){
260-
(*I).second->clear_client_data();
261-
alife().remove_online ((*I).second, false);
261+
if ((*I).second->m_bOnline == true)
262+
{
263+
(*I).second->clear_client_data();
264+
alife().remove_online ((*I).second, false);
265+
}
262266
}
263267

264268
alife().scheduled().add (this);

src/xrGame/inventory_item.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ void CInventoryItem::Load(LPCSTR section)
109109
m_Description = CStringTable().translate( pSettings->r_string(section, "description") );
110110

111111
m_flags.set(Fbelt, READ_IF_EXISTS(pSettings, r_bool, section, "belt", FALSE));
112-
m_can_trade = READ_IF_EXISTS(pSettings, r_bool, section, "can_take", TRUE);
113-
m_flags.set(FCanTake, m_can_trade);
114-
m_flags.set(FCanTrade, READ_IF_EXISTS(pSettings, r_bool, section, "can_trade", TRUE));
112+
m_can_trade = READ_IF_EXISTS(pSettings, r_bool, section, "can_trade", TRUE);
113+
m_flags.set(FCanTake, READ_IF_EXISTS(pSettings, r_bool, section, "can_take", TRUE));
114+
m_flags.set(FCanTrade, m_can_trade);
115115
m_flags.set(FIsQuestItem, READ_IF_EXISTS(pSettings, r_bool, section, "quest_item",FALSE));
116116

117117

0 commit comments

Comments
 (0)