Skip to content

Commit

Permalink
Fix xrGameLA, part 8
Browse files Browse the repository at this point in the history
короче я устал, пусть этим занимается валерок
  • Loading branch information
St4lker0k765 committed Dec 11, 2024
1 parent c62ec51 commit 598604c
Show file tree
Hide file tree
Showing 64 changed files with 858 additions and 534 deletions.
3 changes: 1 addition & 2 deletions src/xrGame/ui/UIPdaSpot.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "stdafx.h"
#include "UIPdaSpot.h"
#include <dinput.h>
#include "Level.h"
#include "map_manager.h"
#include "map_location.h"
Expand Down Expand Up @@ -118,7 +117,7 @@ bool CUIPdaSpot::OnKeyboardAction(int dik, EUIMessages keyboard_action)
{
switch (dik)
{
case DIK_ESCAPE:
case SDL_SCANCODE_ESCAPE:
{
if (IsShown())
{
Expand Down
3 changes: 2 additions & 1 deletion src/xrGameLA/ActorCameras.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@ void CActor::cam_Update(float dt, float fFOV)
da = PI / 1000.f;
if (!fis_zero(r_torso.roll))
da *= r_torso.roll / _abs(r_torso.roll);
for (float angle = 0.f; _abs(angle)<_abs(alpha); angle += da)
float angle = 0.f;
for (; _abs(angle)<_abs(alpha); angle += da)
if (test_point(xrc, xform, mat, ext, radius, angle)) { bIntersect = TRUE; break; }
valid_angle = bIntersect ? angle : alpha;
}
Expand Down
3 changes: 3 additions & 0 deletions src/xrGameLA/ActorHudWetness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ u8 mainLayer_ = 1;

void CActor::ComputeHudWetness()
{
#pragma todo("Implement hud wetness???")
/*
COutfitBase* outfit_with_visor = nullptr;
// outfit with helmet and regular helmets are exlcluding each other, so no need to do extra checks for priority
Expand Down Expand Up @@ -120,4 +122,5 @@ void CActor::ComputeHudWetness()
{
g_pGamePersistent->Environment().SetCastHudGlassEffects(false);
}
*/
}
63 changes: 15 additions & 48 deletions src/xrGameLA/ActorInput.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "stdafx.h"
#include <dinput.h>
#include "pch_script.h"
#include "Actor.h"
#include "Torch.h"
Expand Down Expand Up @@ -40,7 +39,7 @@ extern int hud_adj_mode;

void CActor::IR_OnKeyboardPress(int cmd)
{
if (CAttachableItem::m_dbgItem || hud_adj_mode && pInput->iGetAsyncKeyState(DIK_LSHIFT)) return;
if (CAttachableItem::m_dbgItem || hud_adj_mode && pInput->iGetAsyncKeyState(SDL_SCANCODE_LSHIFT)) return;

if (Remote()) return;

Expand Down Expand Up @@ -69,29 +68,9 @@ void CActor::IR_OnKeyboardPress(int cmd)
m_holder->OnKeyboardPress (cmd);
if(m_holder->allowWeapon() && inventory().Action(cmd, CMD_START)) return;
return;
} else {
if (cmd==kWPN_ZOOM&&!psHoldZoom.test(1))
{
if(inventory().ActiveItem())
{
CWeaponMagazined* pWM = smart_cast<CWeaponMagazined*>(inventory().ActiveItem());
if (pWM)
{
if (IsZoomAimingMode())
{
if(inventory().Action(cmd, CMD_STOP)) return;
}else{
if(inventory().Action(cmd, CMD_START)) return;
}
}else{
if(inventory().Action(cmd, CMD_START)) return;
}
}else{
if(inventory().Action(cmd, CMD_START)) return;
}
} else {
if(inventory().Action(cmd, CMD_START)) return;
}
} else
{
if(inventory().Action(cmd, CMD_START)) return;
}

switch(cmd){
Expand Down Expand Up @@ -143,7 +122,7 @@ void CActor::IR_OnKeyboardPress(int cmd)
mstate_wishful |= mcSprint;
}
}break;
case kCAM_1:{ cam_Set(eacFirstEye); CCustomDetectorR * detectortoshow = inventory().CurrentDetector(); if (detectortoshow)g_player_hud->attach_item(detectortoshow); }break; //Äëÿ âîñòàíîâëåíèÿ äåòåêòîðà â ðóêå
case kCAM_1:{ cam_Set(eacFirstEye); CCustomDetectorR * detectortoshow = inventory().CurrentDetector(); if (detectortoshow)g_player_hud->attach_item(detectortoshow); }break; //Для востановления детектора в руке
case kCAM_2: cam_Set(eacLookAt); break;
case kCAM_3: cam_Set(eacFreeLook); break;
case kNIGHT_VISION: SwitchNightVision(); break;
Expand Down Expand Up @@ -297,7 +276,7 @@ void CActor::IR_OnMouseWheel(int direction)
}
void CActor::IR_OnKeyboardRelease(int cmd)
{
if (CAttachableItem::m_dbgItem || hud_adj_mode && pInput->iGetAsyncKeyState(DIK_LSHIFT)) return;
if (CAttachableItem::m_dbgItem || hud_adj_mode && pInput->iGetAsyncKeyState(SDL_SCANCODE_LSHIFT)) return;

if (Remote()) return;

Expand All @@ -319,21 +298,7 @@ void CActor::IR_OnKeyboardRelease(int cmd)
if(m_holder->allowWeapon() && inventory().Action(cmd, CMD_STOP)) return;
return;
}else{
if (cmd==kWPN_ZOOM&&!psHoldZoom.test(1))
{
if(inventory().ActiveItem())
{
CWeaponMagazined* pWM = smart_cast<CWeaponMagazined*>(inventory().ActiveItem());
if (!pWM || (pWM&&!pWM->IsZoomEnabled()))
{
if(inventory().Action(cmd, CMD_STOP)) return;
}
} else {
if(inventory().Action(cmd, CMD_STOP)) return;
}
} else {
if(inventory().Action(cmd, CMD_STOP)) return;
}
if(inventory().Action(cmd, CMD_STOP)) return;
}


Expand All @@ -349,7 +314,7 @@ void CActor::IR_OnKeyboardRelease(int cmd)

void CActor::IR_OnKeyboardHold(int cmd)
{
if (CAttachableItem::m_dbgItem || hud_adj_mode && pInput->iGetAsyncKeyState(DIK_LSHIFT)) return;
if (CAttachableItem::m_dbgItem || hud_adj_mode && pInput->iGetAsyncKeyState(SDL_SCANCODE_LSHIFT)) return;

if (Remote() || !g_Alive()) return;
// if (conditions().IsSleeping()) return;
Expand Down Expand Up @@ -535,8 +500,8 @@ void CActor::ActorUse()
{
TryToTalk();
}
//îáûñê òðóïà
else if(!Level().IR_GetKeyState(DIK_LSHIFT))
//обыск трупа
else if(!Level().IR_GetKeyState(SDL_SCANCODE_LSHIFT))
{
CUIGameSP* pGameSP = smart_cast<CUIGameSP*>(CurrentGameUI());
if (pGameSP)pGameSP->StartStashUI(this, m_pPersonWeLookingAt);
Expand All @@ -550,7 +515,7 @@ void CActor::ActorUse()
if(object)
element = (u16)RQ.element;

if(object && Level().IR_GetKeyState(DIK_LSHIFT))
if(object && Level().IR_GetKeyState(SDL_SCANCODE_LSHIFT))
{
bool b_allow = !!pSettings->line_exist("ph_capture_visuals",object->cNameVisual());

Expand Down Expand Up @@ -606,7 +571,8 @@ void CActor::OnNextWeaponSlot()
ActiveSlot = KNIFE_SLOT;

u32 NumSlotsToCheck = sizeof(SlotsToCheck)/sizeof(u32);
for (u32 CurSlot=0; CurSlot<NumSlotsToCheck; CurSlot++)
u32 CurSlot = 0;
for (; CurSlot<NumSlotsToCheck; CurSlot++)
{
if (SlotsToCheck[CurSlot] == ActiveSlot) break;
};
Expand Down Expand Up @@ -637,7 +603,8 @@ void CActor::OnPrevWeaponSlot()
ActiveSlot = KNIFE_SLOT;

u32 NumSlotsToCheck = sizeof(SlotsToCheck)/sizeof(u32);
for (u32 CurSlot=0; CurSlot<NumSlotsToCheck; CurSlot++)
u32 CurSlot = 0;
for (; CurSlot<NumSlotsToCheck; CurSlot++)
{
if (SlotsToCheck[CurSlot] == ActiveSlot) break;
};
Expand Down
2 changes: 1 addition & 1 deletion src/xrGameLA/Actor_Feel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ void CActor::PickupModeUpdate()
if (eacFirstEye != cam_active)
feel_touch_update (Position(), m_fPickupInfoRadius);
else {
feel_touch_update (get_bone_position(this, "bip01_spine"), m_fPickupInfoRadius);
feel_touch_update ((Fvector&)get_bone_position(this, "bip01_spine"), m_fPickupInfoRadius);
}

CFrustum frustum;
Expand Down
2 changes: 1 addition & 1 deletion src/xrGameLA/Actor_Network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ BOOL CActor::net_Spawn (CSE_Abstract* DC)
{
static g_Y = 0;
pStatGraph = new CStatGraph();
pStatGraph->SetRect(0, g_Y, Device.dwWidth, 100, 0xff000000, 0xff000000);
pStatGraph->SetRect(0, g_Y, Device.TargetWidth, 100, 0xff000000, 0xff000000);
g_Y += 110;
if (g_Y > 700) g_Y = 100;
pStatGraph->SetGrid(0, 0.0f, 10, 1.0f, 0xff808080, 0xffffffff);
Expand Down
1 change: 1 addition & 0 deletions src/xrGameLA/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ list(APPEND XGM_SRC_FILES ${XGM_SOURCE_ALL_FILES})
# Remove unused files
list(FILTER XGM_SRC_FILES EXCLUDE REGEX "DynamicHeightMap.*")
list(FILTER XGM_SRC_FILES EXCLUDE REGEX "LevelFogOfWar.*")
list(FILTER XGM_SRC_FILES EXCLUDE REGEX "CustomTimer*.cpp")
list(FILTER XGM_SRC_FILES EXCLUDE REGEX "ai/monsters/rats/ai_rat_fsm.*")
list(FILTER XGM_SRC_FILES EXCLUDE REGEX "ui/IUWpnParams.*")
list(FILTER XGM_SRC_FILES EXCLUDE REGEX "ui/UIRankFaction.*")
Expand Down
6 changes: 3 additions & 3 deletions src/xrGameLA/Entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void CEntity::Die(CObject* who)
Level().seniority_holder().team(g_Team()).squad(g_Squad()).group(g_Group()).unregister_member(this);
}

//îáíîâëåíèå ñîñòîÿíèÿ
//обновление состояния
float CEntity::CalcCondition(float hit)
{

Expand Down Expand Up @@ -151,7 +151,7 @@ void CEntity::Load (LPCSTR section)
#pragma todo("Jim to Dima: no specific figures or comments needed")
m_fMorale = 66.f;

//âðåìÿ óáèðàíèÿ òåëà ñ óðîâíÿ
//время убирания тела с уровня
m_dwBodyRemoveTime = READ_IF_EXISTS(pSettings,r_u32,section,"body_remove_time",BODY_REMOVE_TIME);
//////////////////////////////////////
}
Expand All @@ -169,7 +169,7 @@ BOOL CEntity::net_Spawn (CSE_Abstract* DC)
if (E) {
SetfHealth (E->fHealth);

R_ASSERT2(!((E->get_killer_id() != ALife::_OBJECT_ID(-1)) && g_Alive()), make_string("server entity [%s][%d] has an killer [%d] and not dead",
R_ASSERT2(!((E->get_killer_id() != ALife::_OBJECT_ID(-1)) && g_Alive()), make_string<const char*>("server entity [%s][%d] has an killer [%d] and not dead",
E->name_replace(), E->ID, E->get_killer_id()).c_str());
m_killer_id = E->m_killer_id;
if (m_killer_id == ID())
Expand Down
38 changes: 19 additions & 19 deletions src/xrGameLA/HUDCrosshair.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// HUDCrosshair.cpp: êðåñòèê ïðèöåëà, îòîáðàæàþùèé òåêóùóþ äèñïåðñèþ
// HUDCrosshair.cpp: крестик прицела, отображающий текущую дисперсию
//
//////////////////////////////////////////////////////////////////////

Expand All @@ -13,8 +13,8 @@ CHUDCrosshair::CHUDCrosshair ()
//. hShader.create ("editor\\wire");
hShader->create ("hud\\crosshair");

//âû÷èñëèòü è çàïîìíèòü öåíòð ýêðàíà
// center.set(int(Device.dwWidth)/2,int(Device.dwHeight)/2);
//вычислить и запомнить центр экрана
// center.set(int(Device.TargetWidth)/2,int(Device.TargetHeight)/2);
radius = 0;
}

Expand All @@ -25,24 +25,24 @@ CHUDCrosshair::~CHUDCrosshair ()

void CHUDCrosshair::Load ()
{
//âñå ðàçìåðû â ïðîöåíòàõ îò äëèíû ýêðàíà
//äëèíà êðåñòèêà
//все размеры в процентах от длины экрана
//длина крестика
cross_length_perc = pSettings->r_float (HUD_CURSOR_SECTION, "cross_length");
// cross_length = iFloor(0.5f + cross_length_perc*float(Device.dwWidth));
// cross_length = iFloor(0.5f + cross_length_perc*float(Device.TargetWidth));

min_radius_perc = pSettings->r_float (HUD_CURSOR_SECTION, "min_radius");
//min_radius = iFloor(0.5f + min_radius_perc*float(Device.dwWidth));
//min_radius = iFloor(0.5f + min_radius_perc*float(Device.TargetWidth));

max_radius_perc = pSettings->r_float (HUD_CURSOR_SECTION, "max_radius");
//max_radius = iFloor(0.5f + max_radius_perc*float(Device.dwWidth));
//max_radius = iFloor(0.5f + max_radius_perc*float(Device.TargetWidth));

cross_color = pSettings->r_fcolor (HUD_CURSOR_SECTION, "cross_color").get();


radius_speed_perc = pSettings->r_float (HUD_CURSOR_SECTION, "radius_lerp_speed");
}

//âûñòàâëÿåò radius îò min_radius äî max_radius
//выставляет radius от min_radius до max_radius
void CHUDCrosshair::SetDispersion (float disp)
{
Fvector4 r;
Expand Down Expand Up @@ -85,40 +85,40 @@ void CHUDCrosshair::OnRender ()

if (crosshairAnimationType == 2)
{
// Ïðàâàÿ
// Правая
UIRender->PushPoint(center.x + 1 + x_min, center.y - y_min, 0, cross_color, 0, 0);
UIRender->PushPoint(center.x + smeshenie + x_min, center.y - y_max * 0.75, 0, cross_color, 0, 0);
// Ëåâàÿ
// Левая
UIRender->PushPoint(center.x + 1 - x_min, center.y - y_min, 0, cross_color, 0, 0);
UIRender->PushPoint(center.x - smeshenie - x_min, center.y - y_max * 0.75, 0, cross_color, 0, 0);
// Íèæíÿÿ
// Нижняя
UIRender->PushPoint(center.x + 1, center.y + y_min, 0, cross_color, 0, 0);
UIRender->PushPoint(center.x + 1, center.y + y_max, 0, cross_color, 0, 0);
}
else if (crosshairAnimationType == 3)
{
// Ïðàâàÿ
// Правая
UIRender->PushPoint(center.x + 1 + x_min, center.y + y_min, 0, cross_color, 0,0);
UIRender->PushPoint(center.x + smeshenie + x_min, center.y + y_max * 0.75, 0, cross_color, 0,0);
// Ëåâàÿ
// Левая
UIRender->PushPoint(center.x + 1 - x_min, center.y + y_min, 0, cross_color, 0,0);
UIRender->PushPoint(center.x - smeshenie - x_min, center.y + y_max * 0.75, 0, cross_color, 0,0);
// Âåðõíÿÿ
// Верхняя
UIRender->PushPoint(center.x+1, center.y - y_min, 0, cross_color, 0,0);
UIRender->PushPoint(center.x+1, center.y - y_max, 0, cross_color, 0,0);
}
else if (crosshairAnimationType == 4)
{
// 0 Íèæíÿÿ
// 0 Нижняя
UIRender->PushPoint(center.x + 1, center.y + y_min, 0, cross_color, 0, 0);
UIRender->PushPoint(center.x + 1, center.y + y_max, 0, cross_color, 0, 0);
// 1 Âåðõíÿÿ
// 1 Верхняя
UIRender->PushPoint(center.x + 1, center.y - y_min, 0, cross_color, 0, 0);
UIRender->PushPoint(center.x + 1, center.y - y_max, 0, cross_color, 0, 0);
// 2 Ïðàâàÿ
// 2 Правая
UIRender->PushPoint(center.x + x_min + 1, center.y, 0, cross_color, 0, 0);
UIRender->PushPoint(center.x + x_max + 1, center.y, 0, cross_color, 0, 0);
// 3 Ëåâàÿ
// 3 Левая
UIRender->PushPoint(center.x - x_min, center.y, 0, cross_color, 0, 0);
UIRender->PushPoint(center.x - x_max, center.y, 0, cross_color, 0, 0);
}
Expand Down
21 changes: 1 addition & 20 deletions src/xrGameLA/Level_input.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "stdafx.h"
#include <dinput.h>
#include "HUDmanager.h"
#include "../xr_ioconsole.h"
#include "entity_alive.h"
Expand Down Expand Up @@ -82,24 +81,6 @@ void CLevel::IR_OnMouseMove( int dx, int dy )
}
}

class vtune_ {
BOOL enabled_ ;
public:
vtune_ () {
enabled_ = FALSE;
}
void enable () { if (!enabled_) {
Engine.External.tune_resume (); enabled_=TRUE;
Msg ("vtune : enabled");
}}
void disable () { if (enabled_) {
Engine.External.tune_pause (); enabled_=FALSE;
Msg ("vtune : disabled");
}}
} vtune ;



extern CUISequencer* g_tutorial;

#include "../igame_persistent.h"
Expand Down Expand Up @@ -290,7 +271,7 @@ case DIK_MULTIPLY:
#endif // MASTER_GOLD

#ifdef DEBUG
case DIK_RETURN:
case SDL_SCANCODE_RETURN:
bDebug = !bDebug;
return;

Expand Down
3 changes: 1 addition & 2 deletions src/xrGameLA/MainMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "xr_Level_controller.h"
#include "ui\UITextureMaster.h"
#include "ui\UIXmlInit.h"
#include <dinput.h>
#include "ui\UIBtnHint.h"
#include "UICursor.h"
#include "string_table.h"
Expand Down Expand Up @@ -302,7 +301,7 @@ void CMainMenu::IR_OnKeyboardPress(int dik)
Console->Show();
return;
}
if (DIK_F12 == dik){
if (SDL_SCANCODE_F12 == dik){
Render->Screenshot();
return;
}
Expand Down
Loading

0 comments on commit 598604c

Please sign in to comment.