Skip to content

Commit

Permalink
Возможность задать тип хита для secondary-хитов аномалий + отключения…
Browse files Browse the repository at this point in the history
… горения от LightBurn
  • Loading branch information
gunslingermod committed Aug 8, 2021
1 parent b0f4795 commit 2f44df6
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ActorUtils.pas
Original file line number Diff line number Diff line change
Expand Up @@ -4532,6 +4532,9 @@ function Init():boolean; stdcall;
jmp_addr:=xrGame_addr+$27a768;
if not WriteJump(jmp_addr, cardinal(@CEntityAlive__shedule_Update_updateparticles_Patch), 6, true) then exit;

// CEntityAlive::Hit ìîæíî îòêëþ÷èòü âîïðîèçâåäåíèå ïàðòèêëà ãîðåíèÿ äëÿ òèïà eHitTypeLightBurn
nop_code(xrgame_addr+$27be23, 2);

// [bug] áàã â CEntityCondition::BleedingSpeed - èç-çà òîãî, ÷òî èòîãîâîå êðîâîòå÷åíèå áåðåòñÿ êàê ñðåäíåå îò âñåõ ðàí, òî ïðè çàæèâàíèè íåáîëüøîé ðàíû êðîâîòå÷åíèå óñèëèâàåòñÿ
// Äëÿ èñïðàâëåíèÿ çàìåíÿåì ôóíêöèþ íà íàøó ðåàëèçàöèþ, çàîäíî ó÷èòûâàþùóþ è êîýôôèöèåíòû â çàâñèìîñòè îò òèïà õèòà
jmp_addr:=xrGame_addr+$27dd00;
Expand Down
34 changes: 34 additions & 0 deletions Misc.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1599,6 +1599,34 @@ procedure CObjectList__Update_SkipUpdate_Patch(); stdcall;
jmp eax
end;


procedure CorrectSecondaryHitType(zone:pointer; orig_hit_type:cardinal; pNewHitType:pcardinal); stdcall;
var
s:PAnsiChar;
begin
pNewHitType^:=orig_hit_type;
if zone = nil then exit;

s:=get_string_value(GetCObjectSection(zone));
pNewHitType^:=game_ini_r_int_def(s, 'secondary_hit_type', orig_hit_type);
end;


procedure CMosquitoBald__UpdateSecondaryHit_SecondaryHitType_Patch(); stdcall;
asm
push 0 //buffer for hit type
mov ecx, esp

pushad
push ecx
push [esi+$228] // m_eHitTypeBlowout
push esi
call CorrectSecondaryHitType
popad

pop ecx // get new hit type from buffer
end;

function Init():boolean;stdcall;
var
jmp_addr, jmp_addr_to:cardinal;
Expand Down Expand Up @@ -1681,6 +1709,11 @@ function Init():boolean;stdcall;
jmp_addr:=xrEngine_addr+$1b3c0;
if not WriteJump(jmp_addr, cardinal(@CObjectList__Update_SkipUpdate_Patch), 6, true) then exit;

// â CMosquitoBald::UpdateSecondaryHit äîáàâëÿåì âîçìîæíîñòü çàäàâàòü òèï "âòîðè÷íîãî" óðîíà
jmp_addr:=xrGame_addr+$30ed2d;
if not WriteJump(jmp_addr, cardinal(@CMosquitoBald__UpdateSecondaryHit_SecondaryHitType_Patch), 6, true) then exit;


result:=true;
end;

Expand Down Expand Up @@ -1716,6 +1749,7 @@ procedure get_bone_position(obj:pointer; bone_name:pAnsiChar; res:pFVector3); st

// CInventory::Update - xrgame.dll+2a83a0
// CScriptGameObject::buy_supplies - xrgame.dll+1c3df0
// CMosquitoBald::UpdateSecondaryHit - xrgame.dll+30ea90


end.
2 changes: 1 addition & 1 deletion UIUtils.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1902,7 +1902,7 @@ function IsActorBurned():boolean; stdcall;
cond:=GetActorConditions(act);
if cond = nil then exit;

CEntityCondition__BleedingSpeed_reimpl(act, @cond.base_CEntityCondition.m_WoundVector, @burn_amount, (1 shl EHitType__eHitTypeBurn) + (1 shl EHitType__eHitTypeLightBurn));
CEntityCondition__BleedingSpeed_reimpl(act, @cond.base_CEntityCondition.m_WoundVector, @burn_amount, (1 shl EHitType__eHitTypeBurn));

result:=burn_amount > 0;
end;
Expand Down

0 comments on commit 2f44df6

Please sign in to comment.