AmProsius / gothic-1-community-patch

Gothic 1 Community Patch
Other
48 stars 4 forks source link

Game crashes when transforming back near monster #208

Open AmProsius opened 3 years ago

AmProsius commented 3 years ago

Describe the bug When the player character transforms back to human form near a monster, the game crashes.

Expected behavior The game no longer crashes when the player character transforms back to human form near a monster.

Additional context Bug provided by Blubbler.

N1kX94 commented 3 years ago

The crash occurs due to the fact that during/after the transformation, an invisible NPC remains, which is targeted by the attack of monsters and NPCs

07:08 Warn: 0 == ============================================= CALLSTACK : ============================================================== .... <zError.cpp,#467> 07:08 Warn: 0 00 23:00627240 (0x00000001 0x2732C808 0x1E2794B0 0x1FC01028) GothicMod.exe, oCAniCtrl_Human::GetLayerAni, D:\dev\gothic\current_work\Gothic_Ulf\oAniCtrl.cpp, line 2474 .... <zError.cpp,#467> 07:08 Warn: 0 00 23:00627895 (0x00000000 0x007D06E8 0x1E2794B0 0x1FC01028) GothicMod.exe, oCAniCtrl_Human::HitCombo()+421 byte(s), D:\dev\gothic\current_work\Gothic_Ulf\oAniCtrl.cpp, line 2656+40 byte(s) .... <zError.cpp,#467> 07:08 Warn: 0 00 23:006AAE9E (0x1FC01028 0x00000000 0x1E2794B0 0x1FC01028) GothicMod.exe, oCNpc::EV_AttackForward()+1582 byte(s), D:\dev\gothic\current_work\Gothic_Ulf\oNPC.cpp, line 11067 .... <zError.cpp,#467> 07:08 Warn: 0 00 23:006A74F4 (0x1FC01028 0x00000000 0x1FC01028 0x1F8DEB38) GothicMod.exe, oCNpc::OnMessage()+2836 byte(s), D:\dev\gothic\current_work\Gothic_Ulf\oNPC.cpp, line 10171+8 byte(s) .... <zError.cpp,#467> 07:08 Warn: 0 00 23:006DDAE3 (0x1FC01028 0x1E2794B0 0x00000000 0x0BF6BEE4) GothicMod.exe, zCEventManager::SendMessageToHost()+371 byte(s), D:\dev\gothic\current_work\ZenGin_Ulf\zEventMan.cpp, line 269 .... <zError.cpp,#467> 07:08 Warn: 0 00 23:006DDDCF (0x0BF6BCB0 0x005F405F 0x0BEECBC8 0x007DCAC4) GothicMod.exe, zCEventManager::ProcessMessageList()+191 byte(s), D:\dev\gothic\current_work\ZenGin_Ulf\zEventMan.cpp, line 356 .... <zError.cpp,#467> 07:08 Warn: 0 00 23:006DCCA6 (0x0BEECBC8 0x007DCAC4 0x045BBAB0 0x00000000) GothicMod.exe, zCEventManager::DoFrameActivity()+38 byte(s), D:\dev\gothic\current_work\ZenGin_Ulf\zEventMan.cpp, line 145+9 byte(s) .... <zError.cpp,#467> 07:08 Warn: 0 00 23:005F405F (0x0C924D40 0x045BBAB0 0x00000000 0x0126FC64) GothicMod.exe, zCWorld::Render()+415 byte(s), D:\dev\gothic\current_work\ZenGin_Dieter\zWorld.cpp, line 762 .... <zError.cpp,#467> 07:08 Warn: 0 00 23:0063DC76 (0x00000000 0x002B3AB8 0x0126FE74 0x00000000) GothicMod.exe, oCGame::Render()+150 byte(s), D:\dev\gothic\current_work\Gothic_Ulf\oGame.cpp, line 2469 .... <zError.cpp,#467> 07:08 Warn: 0 00 23:00424F73 (0x007D1078 0x00000000 0x001E1094 0x045BBAB0) GothicMod.exe, CGameManager::Run()+1155 byte(s), D:\dev\gothic\current_work\Gothic_Bert\oGameManager.cpp, line 699+25 byte(s) .... <zError.cpp,#467> 07:08 Warn: 0 00 23:006D867B (0x00000000 0x0000002C 0x00000000 0x00000000) GothicMod.exe, MainProg()+75 byte(s), D:\dev\gothic\current_work\Gothic_Ulf\Phoenix.cpp, line 115 .... <zError.cpp,#467> 07:08 Warn: 0 00 23:004F4326 (0x00400000 0x00000000 0x002B3AB8 0x00000001) GothicMod.exe, HandledWinMain()+966 byte(s), D:\dev\gothic\current_work\ZenGin_Carsten\zWin32.cpp, line 772 .... <zError.cpp,#467> 07:08 Warn: 0 00 23:004F3E90 (0x00400000 0x00000000 0x002B3AB8 0x00000001) GothicMod.exe, WinMain()+128 byte(s), D:\dev\gothic\current_work\ZenGin_Carsten\zWin32.cpp, line 684+21 byte(s) .... <zError.cpp,#467> 07:08 Warn: 0 00 23:6E2C12E5 (0x00400000 0x00000000 0x002B3AB8 0x00000001) SHW32.DLL, UnionCore::CUnion::InitApp()+1621 byte(s) .... <zError.cpp,#467> 07:08 Warn: 0 00 23:0077A9B8 (0x7FFDE000 0x76AD7BE0 0xE7D0A15E 0x0126FFDC) GothicMod.exe, WinMainCRTStartup()+224 byte(s) .... <zError.cpp,#467> 07:08 Warn: 0 00 23:76AD7C04 (0x7FFDE000 0x1686430D 0x00000000 0x00000000) KERNEL32.DLL, BaseThreadInitThunk()+36 byte(s) .... <zError.cpp,#467> 07:08 Warn: 0 00 23:772DAD8F (0xFFFFFFFF 0x772C00B6 0x00000000 0x00000000) ntdll.dll, RtlInitializeExceptionChain()+143 byte(s) .... <zError.cpp,#467> 07:08 Warn: 0 00 23:772DAD5A (0x0077A8D8 0x7FFDE000 0x00000000 0x00000000) ntdll.dll, RtlInitializeExceptionChain()+90 byte(s) .... <zError.cpp,#467> 07:08 Warn: 0 == ===================================== UNHANDLED EXCEPTION OCCURED ====================================================== .... <zError.cpp,#467> 07:15 Warn: 0 B: GMAN: gameSession is existing. Call CGameManager::Done() before! .... <oGameManager.cpp,#360>

You can get around it by using a new perception.

// Функция реакции монстров на превращение ГГ (трансформация).
func void B_MM_AssessSurprise()
{
    Npc_SetTarget(self,other);

    if(Npc_GetGuildAttitude(self,other) == ATT_HOSTILE)
    {
        B_FullStop(self);
        B_MM_AssessEnemy();
        return;
    };

    B_FullStop(self);
    AI_Wait(self,1);
    AI_ContinueRoutine(self);
};

func void ZS_MM_Attack()
{
    ***
    Npc_PercEnable(self,PERC_ASSESSSURPRISE,B_MM_AssessSurprise);
    ***
};
N1kX94 commented 3 years ago

It is also possible that this will be fixed in Union, but the authors advise you to fix it in scripts.

#patch [Transform crashfix]
        HEX @0x0062787D = 'E8 35 20 11 00'
        HEX @0x007398B7 = '8B 81 B4 09 00 00 85 C0 74 01 C3 8B 0D B0 BB 8D 00 89 8E C4 01 00 00 8B 81 B4 09 00 00 C3'

        HEX @0x0068C0F0 = 'E9 E0 D7 0A 00'
        HEX @0x007398D5 = 'E8 06 B3 F8 FF 89 F1 68 00 00 00 F0 6A 00 E8 D8 3E F5 FF E9 08 28 F5 FF'
    #/patch