Skip to content

Commit

Permalink
Fix multiplayer?
Browse files Browse the repository at this point in the history
  • Loading branch information
ZivDero committed Sep 22, 2024
1 parent 69a6e0b commit c5a72da
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
20 changes: 14 additions & 6 deletions src/new/viniferaevent/viniferaevent_hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ DECLARE_PATCH(_EventClass_Execute_ViniferaEvent)

DECLARE_PATCH(_Add_Compressed_Events_ViniferaEvent_Length)
{
GET_REGISTER_STATIC(unsigned int, eventtype, esi);
GET_REGISTER_STATIC(unsigned char, eventtype, cl);
static unsigned char eventlength;

_asm pushad
Expand All @@ -76,10 +76,18 @@ DECLARE_PATCH(_Add_Compressed_Events_ViniferaEvent_Length)
eventlength = EventClass::Event_Length(static_cast<EventType>(eventtype));
}

_asm popad
_asm mov bl, eventlength

JMP_REG(esi, 0x005B45E8);
if (eventtype == EVENT_ADDPLAYER)
{
_asm popad
_asm mov bl, eventlength
JMP_REG(esi, 0x005B45EA);
}
else
{
_asm popad
_asm mov bl, eventlength
JMP_REG(esi, 0x005B45F3);
}
}


Expand Down Expand Up @@ -133,7 +141,7 @@ DECLARE_PATCH(_Extract_Compressed_Events_ViniferaEvent_Length2)
void ViniferaEvent_Hooks()
{
Patch_Jump(0x00494294, &_EventClass_Execute_ViniferaEvent);
Patch_Jump(0x005B45E2, &_Add_Compressed_Events_ViniferaEvent_Length);
Patch_Jump(0x005B45D5, &_Add_Compressed_Events_ViniferaEvent_Length);
Patch_Jump(0x005B4AED, &_Extract_Compressed_Events_ViniferaEvent_Length1);
Patch_Jump(0x005B4CF8, &_Extract_Compressed_Events_ViniferaEvent_Length2);
}
9 changes: 4 additions & 5 deletions src/spawner/modules/spectator_hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,23 +203,22 @@ void MapClassExt::_Reveal_The_Map()
DECLARE_PATCH(_HouseClass_MPlayer_Defeated_Dont_Count_Spectators)
{
GET_REGISTER_STATIC(HouseClassExt*, hptr, eax);
_asm push edx
_asm pushad

if (Spawner::Active && hptr != PlayerPtr && Session.Type != GAME_SKIRMISH && hptr->_Is_Spectator())
{
_asm pop edx
_asm popad
JMP(0x004BF74A);
}

// Vanilla code
if (!hptr->IsDefeated && !hptr->Class->IsMultiplayPassive)
{
_asm mov eax, hptr
_asm pop edx
_asm popad
JMP_REG(ebp, 0x004BF730);
}

_asm pop edx
_asm popad
JMP_REG(ebp, 0x004BF75D)
}

Expand Down

0 comments on commit c5a72da

Please sign in to comment.