Skip to content

Commit

Permalink
Network
Browse files Browse the repository at this point in the history
  • Loading branch information
kphoenix137 committed Sep 17, 2024
1 parent b22aef6 commit 0172d60
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Source/inv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2179,7 +2179,7 @@ void DoTelekinesis()
if (pcursmonst != -1) {
Monster &monter = Monsters[pcursmonst];
if (!M_Talker(monter) && monter.talkMsg == TEXT_NONE)
NetSendCmdParam1(true, CMD_KNOCKBACK, pcursmonst);
NetSendCmdParam5(true, CMD_KNOCKBACK, pcursmonst, MyPlayer->position.tile.x, MyPlayer->position.tile.y, 0, 0);
}
NewCursor(CURSOR_HAND);
}
Expand Down
4 changes: 2 additions & 2 deletions Source/missiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,8 @@ bool MonsterMHit(const Player &player, int monsterId, int mindam, int maxdam, in
monster.tag(player);
PlayEffect(monster, MonsterSound::Hit);
} else {
if (monster.mode != MonsterMode::Petrified && missileData.isArrow() && HasAnyOf(player._pIFlags, ItemSpecialEffect::Knockback))
M_GetKnockback(monster, startPos);
if (monster.mode != MonsterMode::Petrified && missileData.isArrow() && HasAnyOf(player._pIFlags, ItemSpecialEffect::Knockback) && &player == MyPlayer)
NetSendCmdParam5(true, CMD_KNOCKBACK, monster.getId(), startPos.x, startPos.y, 0, 0);

Check warning on line 271 in Source/missiles.cpp

View workflow job for this annotation

GitHub Actions / build

'argument': conversion from 'size_t' to 'uint16_t', possible loss of data
if (monster.type().type != MT_GOLEM)
M_StartHit(monster, player, dam);
}
Expand Down
7 changes: 5 additions & 2 deletions Source/msg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1654,12 +1654,15 @@ size_t OnSpellPlayer(const TCmd *pCmd, Player &player)

size_t OnKnockback(const TCmd *pCmd, Player &player)
{
const auto &message = *reinterpret_cast<const TCmdParam1 *>(pCmd);
const auto &message = *reinterpret_cast<const TCmdParam5 *>(pCmd);
const uint16_t monsterIdx = SDL_SwapLE16(message.wParam1);
WorldTilePosition startPos;
startPos.x = SDL_SwapLE16(message.wParam2);

Check warning on line 1660 in Source/msg.cpp

View workflow job for this annotation

GitHub Actions / build

'=': conversion from 'const uint16_t' to 'CoordT', possible loss of data
startPos.y = SDL_SwapLE16(message.wParam3);

Check warning on line 1661 in Source/msg.cpp

View workflow job for this annotation

GitHub Actions / build

'=': conversion from 'const uint16_t' to 'CoordT', possible loss of data

if (gbBufferMsgs != 1 && player.isOnActiveLevel() && monsterIdx < MaxMonsters) {
Monster &monster = Monsters[monsterIdx];
M_GetKnockback(monster, player.position.tile);
M_GetKnockback(monster, startPos);
M_StartHit(monster, player, 0);
}

Expand Down
4 changes: 2 additions & 2 deletions Source/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -677,8 +677,8 @@ bool PlrHitMonst(Player &player, Monster &monster, bool adjacentDamage = false)
if ((monster.hitPoints >> 6) <= 0) {
M_StartKill(monster, player);
} else {
if (monster.mode != MonsterMode::Petrified && HasAnyOf(player._pIFlags, ItemSpecialEffect::Knockback))
M_GetKnockback(monster, player.position.tile);
if (monster.mode != MonsterMode::Petrified && HasAnyOf(player._pIFlags, ItemSpecialEffect::Knockback) && &player == MyPlayer)
NetSendCmdParam5(true, CMD_KNOCKBACK, monster.getId(), player.position.tile.x, player.position.tile.y, 0, 0);

Check warning on line 681 in Source/player.cpp

View workflow job for this annotation

GitHub Actions / build

'argument': conversion from 'size_t' to 'uint16_t', possible loss of data
M_StartHit(monster, player, dam);
}
return true;
Expand Down

0 comments on commit 0172d60

Please sign in to comment.